I have a KS script and I'm trying to do the following:
1) Run character to instance (honor party etc)
2) Run through instance till bags are full
3) Drop party to reset the instance and boot character to res point
4) Sell up at Pancer
5) Rince and Repeat
All of this is simple enough (with emphasis on simple). One of the issues I'm trying to solve is that the bot may fall off a wall, or get stuck target-switching (switching between 2 targets in an endless loop as it times out because of a random pixel in the way). It is simple enough from an individual waypoint to do a:
Code: Select all
player:clearTarget();
sendMacro("LeaveParty();");
waitForLoadingScreen(10);
player:update();
__WPL:setWaypointIndex(__WPL:findWaypointTag("rerun"));
e.g.
Code: Select all
--A list of waypoints, and maximum time before we reset. e.g. [6]=60 -> waypoint index 6 should be reached within 60 seconds.
KS_TimingChecks = {[6]=60, [17]=300, [20]=400, [36]=480, [51]=660, [59]=780, [66]=1020, [80]=1220, [89]=1400, [97]=1560, [111]=1760};
KS_StartTime = os.time(); --when we started the run (resets in waypoint rerun)
KS_DEBUG = false; --turn of debug logging
function PrintLine(_text)
if (KS_DEBUG == true) then printf(tostring(os.date("%c"))..": ".._text.."\n"); end;
end;
function KS_checkTiming()
PrintLine("Checking timing");
local idx = __WPL.CurrentWaypoint;
local t = (os.time() - KS_StartTime);
PrintLine("KS_StartTime = "..os.date("%c", KS_StartTime));
PrintLine("t="..tostring(t));
for k,v in pairs(KS_TimingChecks) do
PrintLine("checking t vs v => ("..tostring(t).."v"..tostring(v)..")");
if (t > tonumber(v)) then
PrintLine(" ->"..tostring(k).." > "..tostring(idx));
if (tonumber(k) > idx) then
printf("Exiting dungeon as time("..tostring(t)..") exceeds time("..tostring(v)..") - should be at waypoint #"..tostring(k).." by now\n");
player:clearTarget();
sendMacro("LeaveParty();");
waitForLoadingScreen(10);
player:update();
__WPL:setWaypointIndex(__WPL:findWaypointTag("rerun"));
end;
end;
end
end;
PrintLine("registering timer");
PrintLine("KS_StartTime = "..os.date("%c", KS_StartTime));
registerTimer("KS_Timer", 30000, KS_checkTiming);
Code: Select all
04/11/12 12:44:09: checking t vs v => (620v600)
04/11/12 12:44:09: ->50 > 42
Clearing target.
Use MACRO: Executing RoMScript "LeaveParty();".
Stripping: You have left the party.
Stopping waypoint: Target acquired.
Did not find any crashed game clients.
12:44am - scripts\rom/start_character.lua:4: ...:/Installs/micromacro/scripts/rom
/classes/player.lua:3801: attempt to compare number with nil