Page 1 of 2
Switch path's on death?
Posted: Fri Jul 22, 2011 3:44 pm
by botje
Code: Select all
<onDeath><![CDATA[
-- Additional Lua code to execute on death
if RoMScript("GetZoneID()") == 11 then
loadPaths("Dragonfang/CyclopsShop");
end
]]></onDeath>
doesnt seem to work, any pointers anyone?
Botje
Re: Switch path's on death?
Posted: Fri Jul 22, 2011 6:56 pm
by lisa
probably have to check when the ondeath event is used. Is it used when you die or after you resurect.
Re: Switch path's on death?
Posted: Sat Jul 23, 2011 10:34 am
by botje
and where do i check that?
Botje
Re: Switch path's on death?
Posted: Sat Jul 23, 2011 10:43 am
by rock5
I just had a look. It looks like it executes before it resurrects.
Re: Switch path's on death?
Posted: Sat Jul 23, 2011 10:54 am
by botje
also, my function i not found anymore in last update.
bot errors now saying: 5:38pm - [string "Return()"]:1: attempt to call global 'Return' (a nil value)
botje
nvm, works again, proberly a fluke
Re: Switch path's on death?
Posted: Sat Jul 23, 2011 11:08 am
by botje
seems onload is broken? O.o
yes im sure now, waypoint onload is broken >.<
Re: Switch path's on death?
Posted: Sat Jul 23, 2011 11:20 am
by rock5
I did change something with the waypoint onload. It now runs after the profile onload. It does work though. I tested it. Maybe it has something to do with the order they run. What do you have in your onloads?
Re: Switch path's on death?
Posted: Sat Jul 23, 2011 12:12 pm
by botje
Profile:
Code: Select all
<onLoad><![CDATA[
-- Additional Lua code to execute after loading the profile
-- and before the bot starts. e.g. You could overwrite profile settings here
-- like: changeProfileOption("HP_REST", 60);
if player.Class1 == CLASS_KNIGHT then
settings.profile.options.EGGPET_ASSIST_SLOT = 4
else
settings.profile.options.EGGPET_ASSIST_SLOT = 1
end
startGMDetect()
]]></onLoad>
waypoint:
Code: Select all
<onLoad>
function Return()
printf("Bag spaces free: "..inventory:itemTotalCount(0).."\n");
printf("Weapon Durbility: "..inventory:getMainHandDurability().."\n");
if 5 > inventory:itemTotalCount(0) or 50 > inventory:getMainHandDurability() then
printf("Going to shop, loading new waypoint...\n");
sendMacro("LeaveParty();");
waitForLoadingScreen(15);
loadPaths("Dragonfang/CyclopsShop");
end
end
settings.profile.options.WAYPOINT_DEVIATION = 0
settings.profile.options.MAX_TARGET_DIST = 95
</onLoad>
Re: Switch path's on death?
Posted: Sat Jul 23, 2011 6:39 pm
by botje
and to get back to the original problem, even if it fires before resurrection, it should still load waypoint right?
Botje
PS, went back 1 revision, and onload works again.
Re: Switch path's on death?
Posted: Sat Jul 23, 2011 10:49 pm
by rock5
This is my test function. It worked perfectly.
Code: Select all
<onLoad>
function Return()
print("This function executed successfully")
end
</onLoad>
<!-- # 1 --><waypoint x="6791" z="6332" y="89"> Return()</waypoint>
Code: Select all
Moving to waypoint #1, (6791, 6332)
This function executed successfully
Where exactly are you calling the "Return()" function from?
botje wrote:and to get back to the original problem, even if it fires before resurrection, it should still load waypoint right?
I think so, except you wouldn't have changed zone yet if that's what the zone check if for.
Re: Switch path's on death?
Posted: Sun Jul 24, 2011 2:44 am
by rock5
If your onload issue is related to an issue brought up by another poster then try updating to the latest revision. It might work now.
Re: Switch path's on death?
Posted: Sun Jul 24, 2011 9:56 am
by botje
well, last revision fixed onload for me so
ill check to see if the ondeath thing works now too.
but i first have to die xd
Botje
Re: Switch path's on death?
Posted: Sun Jul 24, 2011 10:44 am
by rock5
Like I said, I think the zone check will make it fail. If you are in the instance when you die then it won't load the file.
Re: Switch path's on death?
Posted: Sun Jul 24, 2011 10:56 am
by botje
but i do check for the instance actually, if i die in cyclops, it loads next path.
so it should work actually.
Botje
Re: Switch path's on death?
Posted: Mon Jul 25, 2011 4:45 am
by botje
i was actually wondering why the hell it fires before resurrection?
i mean, till we ress, were lying dead on teh floor, so wtf should we be able to do then?
wont it make more sence if it fired AFTER ressurection?
just wondering
Botje
Re: Switch path's on death?
Posted: Mon Jul 25, 2011 4:47 am
by lisa
Easy question, to accept resurection from a healer =)
You can make it release in that part of the profile and then do other code or just do other code. By doing it before release it gives you the option for both. If it was only after then you don't have the option.
Re: Switch path's on death?
Posted: Mon Jul 25, 2011 4:52 am
by lisa
what you want to do is something like this
Code: Select all
<onDeath><![CDATA[
RoMScript("BrithRevive();");
waitForLoadingScreen()
yrest(settings.profile.options.WAIT_TIME_AFTER_RES);
player:update();
if RoMScript("GetZoneID()") == 11 then
loadPaths("Dragonfang/CyclopsShop");
end
]]></onDeath>
The BrithRevive is not a typo, that is the actual function name in game.
Re: Switch path's on death?
Posted: Mon Jul 25, 2011 8:14 am
by botje
aaah, yeah, i forgot about that xd
now it makes more sence ^^
Thanx for that code btw, ill see if i can get it to work.
Botje
Re: Switch path's on death?
Posted: Sun Jul 31, 2011 7:49 pm
by Edamh
lisa wrote:what you want to do is something like this
Code: Select all
<onDeath><![CDATA[
RoMScript("BrithRevive();");
waitForLoadingScreen()
yrest(settings.profile.options.WAIT_TIME_AFTER_RES);
player:update();
if RoMScript("GetZoneID()") == 11 then
loadPaths("Dragonfang/CyclopsShop");
end
]]></onDeath>
The BrithRevive is not a typo, that is the actual function name in game.
I have something similar to Lisa's code example within a WP file.
Code: Select all
<?xml version="1.0" encoding="utf-8"?><waypoints>
<onDeath><![CDATA[
print("Inside onDeath within WP file")
RoMScript("BrithRevive();");
waitForLoadingScreen()
yrest(settings.profile.options.WAIT_TIME_AFTER_RES);
player:update();
loadPaths("WPFILENAME");
]]></onDeath>
<!-- # 1 --> ... etc.
Here is the character's resurrection profile setting
Code: Select all
<option name="RES_AUTOMATIC_AFTER_DEATH" value="true" />
However, more than 5x the last couple of days, I have come back to the bot with a prompt to rez. Is my expectation that the bot should autorez and continue with the listed WPfilename using the above code not accurate? Am I missing something?
Furthermore, I am not seeing the printline within the onDeath section of the WP file. I should see that whenever the bot "dies", correct? Here's the shell output:
Code: Select all
Use MACRO: Looting target in distance 64.
Clearing target.
Saved a screenshot to: D:/micromacro/scripts/rom/profiles/CHARNAME.bmp
You have died... Sorry.
Script paused until you revive yourself. Press Delete when you're ready to conti
nue.
There's no expected "Inside onDeath within WP file" output. Any thoughts? Is the onDeath section within the WP file not being loaded? Thanks.
Re: Switch path's on death?
Posted: Sun Jul 31, 2011 9:36 pm
by lisa
the ondeath is done before any of the normal code for dealing with death. So after it does that code it will then take the pic and what not. So in my case the char dies, revives, logs next character. bot then takes a pic. waits the 60 seconds and then continues.
This is my ondeath for my cot profile.
Code: Select all
<onDeath><![CDATA[
yrest(2000)
RoMScript("BrithRevive();");
waitForLoadingScreen()
flyoff()
local filename = getExecutionPath() .. "/logs/shells.log";
local file, err = io.open(filename, "a+");
if file then
file:write(" Character name: " ..player.Name.. " \tDate: " .. os.date() .. " \tShells gained: "..currentshells - numshells..
"\tTotal shells: "..currentshells.. "\n")
file:close();
end
yrest(2000)
sendMacro("}LoginNextToon=true;a={")
sendMacro("Logout();");
waitForLoadingScreen();
loadPaths("cot_tele");
]]></onDeath>
So it does all of that code and then continues on afterwards.
Edit sorry totally didn't read the bit where you put ondeath into the Wp
ondeath is an event for your profile, not WP