Switch path's on death?

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Message
Author
User avatar
botje
Posts: 656
Joined: Wed Oct 27, 2010 7:17 am

Switch path's on death?

#1 Post 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
User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Switch path's on death?

#2 Post by lisa »

probably have to check when the ondeath event is used. Is it used when you die or after you resurect.
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
User avatar
botje
Posts: 656
Joined: Wed Oct 27, 2010 7:17 am

Re: Switch path's on death?

#3 Post by botje »

and where do i check that?

Botje
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Switch path's on death?

#4 Post by rock5 »

I just had a look. It looks like it executes before it resurrects.
  • 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.”
          • Ronald Reagan
User avatar
botje
Posts: 656
Joined: Wed Oct 27, 2010 7:17 am

Re: Switch path's on death?

#5 Post 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
User avatar
botje
Posts: 656
Joined: Wed Oct 27, 2010 7:17 am

Re: Switch path's on death?

#6 Post by botje »

seems onload is broken? O.o

yes im sure now, waypoint onload is broken >.<
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Switch path's on death?

#7 Post 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?
  • 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.”
          • Ronald Reagan
User avatar
botje
Posts: 656
Joined: Wed Oct 27, 2010 7:17 am

Re: Switch path's on death?

#8 Post 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>
User avatar
botje
Posts: 656
Joined: Wed Oct 27, 2010 7:17 am

Re: Switch path's on death?

#9 Post 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.
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Switch path's on death?

#10 Post 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.
  • 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.”
          • Ronald Reagan
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Switch path's on death?

#11 Post 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.
  • 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.”
          • Ronald Reagan
User avatar
botje
Posts: 656
Joined: Wed Oct 27, 2010 7:17 am

Re: Switch path's on death?

#12 Post 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
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Switch path's on death?

#13 Post 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.
  • 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.”
          • Ronald Reagan
User avatar
botje
Posts: 656
Joined: Wed Oct 27, 2010 7:17 am

Re: Switch path's on death?

#14 Post 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
User avatar
botje
Posts: 656
Joined: Wed Oct 27, 2010 7:17 am

Re: Switch path's on death?

#15 Post 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 :P

Botje
User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Switch path's on death?

#16 Post 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.
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Switch path's on death?

#17 Post 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.
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
User avatar
botje
Posts: 656
Joined: Wed Oct 27, 2010 7:17 am

Re: Switch path's on death?

#18 Post 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
User avatar
Edamh
Posts: 106
Joined: Tue May 24, 2011 11:56 pm

Re: Switch path's on death?

#19 Post 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.
User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Switch path's on death?

#20 Post 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
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
Post Reply