Something I've been missing for a while is an onWaypoint event, ie to be able to specify code that would trigger on each waypoint unless there is a coded action in which would override. I use it for boss proximity checking or to code actions in wander waypoint files.
It turned out rather simple to make the event, I haven't looked into reading it from config file though.
Changes necessarily is below (in bot.lua approx line 760)
else
__WPL:advance();
-- Execute it's action, if it has one.
if( wp.Action and type(wp.Action) == "string" and string.find(wp.Action,"%a") ) then
keyboardRelease( settings.hotkeys.MOVE_FORWARD.key ); yrest(200) -- Stop moving
local actionchunk = loadstring(wp.Action);
assert( actionchunk, sprintf(language[150], __WPL.CurrentWaypoint) );
actionchunk();
-- Start onWaypoint code
else
if( type(settings.profile.events.onWaypoint) == "function" ) then
local status,err = pcall(settings.profile.events.onWaypoint);
if( status == false ) then
local msg = sprintf("onWaypoint error: %s", err);
error(msg);
end
end
end
-- end onWaypoint code
end
I think the reason it was never implemented was because if you want something checked on a regular basis then you can use a timer event and in most cases it would work better.
But if we did have an onwaypoint event I would think that it should run regardless if there is actual code at the waypoint. It should run at every waypoint.
Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
I don't know. What uses is it likely to be used for? I can think of one. Instead of putting player:harvest() at every waypoint it would be simpler to just add it to the onwaypoint.
Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
I guess it's because it would stop at every waypoint. Wouldn't be much of an issue if you took care not to make too many waypoints and keep them far apart between nodes.
That would be an issue to deal with though, as any code at waypoints makes it stop. Of course any code in the onwaypoint would be separate and probably we would have to decide if we want it to stop at every waypoint or not. I say no but then if the code in the onwaypoint requires the character to stop then the user would have to include a stop. Maybe we would have to add a 'stopmoving' function to simplify it for users.
Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.