onWaypoint
Posted: Wed Nov 02, 2011 12:32 pm
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)
regards
-f
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)
regards
-f
Code: Select all
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