Page 1 of 1
Floor Diving after loading a second wp
Posted: Fri Jul 03, 2015 5:29 am
by beanybabe
I think there is a bug some where in the load wp.
I have a wp that works perfectly 95 percent of the time.
When I call this wp from another wp the character will be stuck in the floor almost every time. It will not see the npc and other crazy stuff.
I have tried player:update waitforloadscreen and other stuff both before and after launching the second wp.
Anyone have idea how to fix this. I hate to have to rip the second wp and make into a onload script that be to hard for me.
Re: Floor Diving after loading a second wp
Posted: Fri Jul 03, 2015 6:05 am
by BlubBlab
I think the bot tries to go to another waypoint than WP 1 I had this kind of stuff very often back in the days.
Re: Floor Diving after loading a second wp
Posted: Fri Jul 03, 2015 8:44 am
by beanybabe
This may be what caused it.. I was entering a mini game then calling the new wp. The first line of new wp had player:update after removing that the problem seems to have stopped.
Re: Floor Diving after loading a second wp
Posted: Sat Jul 04, 2015 1:31 am
by BlubBlab
What you also must think of is that code lines after loadPaths will be still be executed in the block(WP or onload),so either but it at then of your code block or write:
Re: Floor Diving after loading a second wp
Posted: Sat Jul 04, 2015 3:12 am
by beanybabe
the code is pretty strait though and just runs in a loop it works no matter were you start at.
I think the problem is in memory. I managed to get it to work several times. Need to work on money
and mail handling then let it process few chars and see how stable it is.
onload
if this and that
travel to
end
if this not that
loadpath"xxx"
end
if this
travel to
end
/onload
Re: Floor Diving after loading a second wp
Posted: Sat Jul 04, 2015 3:38 am
by BlubBlab
Your:
if this
travel to
end
will be executed after the new wp is loaded .
In the earlier days I think it was so that the onload part was also executed immediately this isn't the case anymore so far I know.
The thought error which a lot of people make is that the onload function stops after the new WP is loaded because we have a new onload function this isn't the case.
There is no way a function can overwrite and stops the its calling function, so it is saver either but it on the end of the block or return it out.
Re: Floor Diving after loading a second wp
Posted: Sat Jul 04, 2015 12:57 pm
by rock5
What BlubBlab said is true and also applies to the code in waypoints. If there is any change of the code after a loadPaths being executed it's best to play it safe and follow it with a "return".
Note: if you do a travelTo in the onload remember that the bot automatically finds the nearest waypoint to start from when the waypoint file is loaded, before the onload runs. So once the travelTo has completed the previously found waypoint might be wrong so you might need to set it. Eg.
Code: Select all
__WPL.setWaypointIndex(__WPL:getNearestWaypoint())
Re: Floor Diving after loading a second wp
Posted: Sun Jul 05, 2015 2:15 am
by beanybabe
Ill need to study that some. I seem to make sence to me. It always bugged me to just pop out of a function with out a return.
Re: Floor Diving after loading a second wp
Posted: Tue Jul 14, 2015 11:00 am
by beanybabe
I got it working finally some day i may figure way to have it recover on crash. I still notice that the check for honor fails some times.
Here is a new one for me when interactacting with some slow apearing npcs and some times it see them other times it skips them. I added a yrest(7000) to start of wp and near the slow npcs that seemed to fix that problem.