3. I understand. There are a lot of functions that do some task and, even though they don't need to return any value, they benefit from returning false so users can take some action if the function fails, if they choose to do so. But checking the returned value is optional and in most cases most users will just use the function without taking steps to deal with failure. And mostly, with these types of functions, it's not disastrous if the function fails. And in fact they probably don't even error if they fail, they probably just print a warning message then continue.
So... the point I'm making is TravelTo would still mostly be used directly without dealing with the returned value so it should be safe to do so. It certainly isn't safe to continue if TravelTo fails so it has to error.
This brings to mind the conundrum I'm always facing when adding error checking in functions. Do I display a warning and continue or error and stop the script? I guess it depends on whether a script can continue with that error or not.
The pseudo code is acceptable. That way you can use it the way you want to and it is still "safe" for normal use.
4. Yeah, so I think mount() should be added to any functions that need it. If you think it should be added to any particular functions, let know.
As for travel, I can't see where it would attack enemies. Usually it attack enemies during moveto commands but all the ones I can see have true as the second argument so should ignore mobs. Are you sure it's not attacking mobs just before it reaches the teleport npc and before it actually runs the TravelTo function? What's the last thing on micromacro just before it attacked the mob?
Celesteria wrote:it would be nice to have a function to add connections on runtime. so somebody can write a new LocationAToLocationB-functions for only one script and connect it to a teleporter. I didnt find a fast way to implement this
The easiest way to to make a path to the area you want to go is just use a waypoint file. You could just create a separate travel waypoint file and load it at the end of you last waypoint file eg.
last waypoint file
Code: Select all
TraveTo("destination")
loadPaths("locationToLocation.xml")
locationToLocation.xml
Code: Select all
<waypoints>
...
loadPaths("daily.xml")
</waypoint>
</waypoints>
Or you could do it all in one which is the way I like to do it.
daily.xml
Code: Select all
<waypoints>
<onload>
if wrong zone then
TravelTo(right zone)
end
</onload>
<!-- waypoints from travel npc to daily npc -->
<waypoint...
<waypoint...
etc.
<!-- NPC waypoint and waypoint loop to do daily -->
<waypoint ... tag="NPC"> -- the npc waypoint
<waypoint...
<waypoint...
etc.
<!-- The last waypoint should loop back to the npc -->
<waypoint... > __WPL:setWaypointIndex(__WPL:findWaypointTag("NPC")) </waypoint>
</waypoints>
Hope that helps.
Celesteria wrote:oh and another idea is: what do you think about adding the posibility to use a destination from transportbook. if there is no existing connection then read the transportbook and look if there is a point with this destination as name ... just for extending the posibilities. I can implement the code to read the book, but to implement it into your script, I should have to have a closer look and understanding of what you are doing ... but I told you, I am a lazy person
I think TravelTo is about using the teleporters to get to your destination. I thin using the Transport Book should be separate. Plus, even though using the transport book is fairly simple, implementing it in TravelTo would be hard because the transport points could be named anything.