-
althalos
- Posts: 19
- Joined: Thu Feb 04, 2010 10:20 am
#1
Post
by althalos » Fri Jun 04, 2010 11:41 am
I've had a problem for a while now, and can't find a solution on this forum (yet). While botting in an area with aggressive enemies, I have written code to teleport myself to my registered location when my main hand durability or potions get below a certain level. The script then pauses for the load screen, and loads a new waypoint file to get me to the appropriate shop to repair and restock (standard stuff). However, if the teleport gets interrupted by aggro, it still pauses for the allotted time, and I take massive damage and sometimes death. Clearly, I bot without watching the game and have ironed out pretty much all the wrinkles except this one. Has anyone else had this problem and devised a workaround? Should I just load a return waypoint, and if so, could it be made from one of my existing waypoints and just run in reverse? An example of code would be much appreciated. Thanks.
Fo' my code:
Code: Select all
<onLeaveCombat>
-- Additional Lua code to execute after killing an enemy
printf("\nCurrent Stats:\n");
printf("---------------------------\n\n");
printf("Health:%s\n", player.HP);
local dura = inventory:getMainHandDurability();
printf("Weapon Durability:%s\n", dura);
if (0.55 > dura) then
yrest(10000);
RoMScript("UseSkill(1,2);"); --recall
yrest(40000);
player:update();
__WPL:setForcedWaypointType("TRAVEL");
loadPaths("Ystra Snoop to Jacques.xml"); --load repair path from teleport drop
-- yrest(40000);
end;
local poti = inventory:itemTotalCount("Regeneration Mixture");
printf("Health Potions:%s\n\n", poti);
if (11 > poti) then
yrest(10000);
RoMScript("UseSkill(1,2);"); --recall
yrest(40000);
__WPL:setForcedWaypointType("TRAVEL");
-- yrest(40000);
player:update();
loadPaths("Ystra Snoop to Jacques.xml"); --load repair path from teleport drop
end;
</onLeaveCombat>
-
rock5
- Posts: 12173
- Joined: Tue Jan 05, 2010 3:30 am
- Location: Australia
#2
Post
by rock5 » Fri Jun 04, 2010 12:09 pm
First of all you don't need to do 2 separate 'if' statements that do the same thing, just use;
Code: Select all
if (0.55 > dura) or (11 > poti) then
After looking at your code a possible solution occurs to me. If you use
Code: Select all
__WPL:setForcedWaypointType("RUN");
before loadPath, it should ignore attacks while it teleports. That's assuming you can handle a bit of damage while teleporting and mob attacks don't interrupt teleports.
- 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.
- How to: copy and paste in micromacro
________________________
Quote:
- “They say hard work never hurt anybody, but I figure, why take the chance.”
-
althalos
- Posts: 19
- Joined: Thu Feb 04, 2010 10:20 am
#3
Post
by althalos » Fri Jun 04, 2010 12:39 pm
Mob attacks do interrupt teleports, that's the problem.
-
rock5
- Posts: 12173
- Joined: Tue Jan 05, 2010 3:30 am
- Location: Australia
#4
Post
by rock5 » Fri Jun 04, 2010 12:55 pm
althalos wrote:Mob attacks do interrupt teleports, that's the problem.
There's probably a way to check if you are still in combat before attempting to teleport but I don't know how you can deal with being interrupted after you've already started teleporting.
I think the way you are doing it is wrong anyway. Return scripts are usually related to the waypoint file. If you load a different waypoint file wouldn't your onLeaveCombat become obsolete, or at least need to be edited?
I personally would choose certain safe points in the waypoint file to check your dura and potions and teleport. After all, your dura doesn't drop so fast that you need to check it after every combat.
What do you think?
- 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.
- How to: copy and paste in micromacro
________________________
Quote:
- “They say hard work never hurt anybody, but I figure, why take the chance.”
-
althalos
- Posts: 19
- Joined: Thu Feb 04, 2010 10:20 am
#5
Post
by althalos » Fri Jun 04, 2010 1:45 pm
I agree, I don't need to check my dura after every combat, but it seems a moot point becuase it only takes a couple of seconds. But I see what you're saying; If I check it at, say, the end of the waypoints, which starts me standing on a safe path, I shouldn't be interrupted. Thanks for the idea.
Who is online
Users browsing this forum: No registered users and 1 guest