Add timeout
Posted: Mon Oct 17, 2011 1:41 pm
Hi,
my cyclops bot doesn't actually target enemies, it attacks them using the following command:
Obviously that code is packed into an userfunction so it doesn't cram the waypoint file. Now what sometimes happens is that the bot lags for a second (because I'm running several clients) and accidentally walks too far. Then the enemies go into the wall and are invincible. Then the bot just stucks there, continuously casting purgatory fire and sometimes healing himself. Sometimes, when I'm lucky, it runs out of mana and can't heal itself and dies, but sometimes it stucks there for hours.
So here's my question:
How do I add a timeout into that function? I want the bot to try for a while, but stop and go to the next waypoint after a couple of minutes.
Any ideas?
my cyclops bot doesn't actually target enemies, it attacks them using the following command:
Code: Select all
player:cast("MAGE_PURGATORY_FIRE");
repeat
if 12000 > player.HP and not player:hasBuff("500469") then
player:cast("PRIEST_REGENERATE");
end;
if 6000 > player.HP then
player:cast("PRIEST_URGENT_HEAL");
end;
player:cast("MAGE_PURGATORY_FIRE");
until not player.Battling;
yrest(50);
player:lootAll();
if inventory:itemTotalCount(0) == 0 then
yrest(1000);
sendMacro("ViewDistanceSlider_SetValue(400)");
sendMacro("LeaveParty()");
waitForLoadingScreen();
yrest(3000);
__WPL:setWaypointIndex(__WPL:findWaypointTag("Zumhaendler"));
end
So here's my question:
How do I add a timeout into that function? I want the bot to try for a while, but stop and go to the next waypoint after a couple of minutes.
Any ideas?