"onLoad" not executed for userdefault-profile

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
Andreas_B
Posts: 40
Joined: Fri Oct 22, 2010 6:46 pm

"onLoad" not executed for userdefault-profile

#1 Post by Andreas_B » Sun Jun 19, 2011 3:42 am

I use the bot mainly for daily-quests. In the profile-onLoad I have some output to see the char data. (useful for client crashes).

Code: Select all

		repeat server=RoMScript("GetServerName()"); yrest(100) until server;
	    cprintf(cli.red,"Server: "..server..".\n");
		repeat account=RoMScript("GetAccountName()"); yrest(100) until account;
	    cprintf(cli.red,"Account: "..account..".\n");
		repeat char=RoMScript("UnitName('player')"); yrest(100) until char;
	    cprintf(cli.red,"Charakter: "..char..".\n");
This code will not be executed within a userdefault-profile.

Bug or feature?

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

Re: "onLoad" not executed for userdefault-profile

#2 Post by lisa » Sun Jun 19, 2011 5:08 am

That would work except I think you will find the global server is already used.

Just change it to something else, _server works

Code: Select all


     repeat _server=RoMScript("GetServerName()"); yrest(100) until _server;
       cprintf(cli.red,"Server: ".._server..".\n");
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

Andreas_B
Posts: 40
Joined: Fri Oct 22, 2010 6:46 pm

Re: "onLoad" not executed for userdefault-profile

#3 Post by Andreas_B » Tue Jun 28, 2011 8:37 am

The code works within every profile except the userdefault-profile. The variables are locally defined.

Therefore I think there is something wrong with the execution of this special profile. "OnLoad" will not be executed with the userdefault-profile.

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

Re: "onLoad" not executed for userdefault-profile

#4 Post by rock5 » Tue Jun 28, 2011 9:27 am

Initial test confirm it. I can't get any code in profile onload to work. I don't have time to look at it at the moment though.
  • 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
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: "onLoad" not executed for userdefault-profile

#5 Post by lisa » Tue Jun 28, 2011 11:21 am

Works fine for me, just remember the profile onload isn't done if you use path:commandline

Code: Select all

	
<onLoad><![CDATA[
printf("this works\n")
]]></onLoad>

Code: Select all

Loading profile default.xml
MACRO Test: ok
Ranged skill found: PRIEST_RISING_TIDE
[DEBUG] CPU Frequency 1948.31
Table range not found for ID: 495602
Table range not found for ID: 492767
Table range not found for ID: 493301
Table range not found for ID: 492210
Table range not found for ID: 492203
We will wander arround in a radius of 500
No return path with default naming wander_return.xml found.
We use the normal waypoint path <NONE> now.
We will wander around with a radius of 500.
this works
Clearing target.
Moving to waypoint #0, (2952, 813)
Paused. (Delete) to continue, (CTRL+L) exit to shell, (CTRL+C)
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

Andreas_B
Posts: 40
Joined: Fri Oct 22, 2010 6:46 pm

Re: "onLoad" not executed for userdefault-profile

#6 Post by Andreas_B » Tue Jun 28, 2011 2:22 pm

lisa wrote:Works fine for me, just remember the profile onload isn't done if you use path:commandline
For all profiles except the userdefault-profile the profile-"Onload" works together with a given path:commandline.

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

Re: "onLoad" not executed for userdefault-profile

#7 Post by rock5 » Tue Jun 28, 2011 7:25 pm

lisa wrote:Works fine for me, just remember the profile onload isn't done if you use path:commandline
I did think of that. I did my testing wil my logarcraft waypoint file.

I'm not sure what I did wrong yesterday but today all my tests worked. That includes using the userdefault profile. I added

Code: Select all

tester = 5
print("profile tester",tester)
to my profile onLoad and

Code: Select all

print("waypoint tester",tester)
to one of the waypoints in my waypoint file. It printed both lines with the value of 5.

Thing to note is the profile onLoad happens after the waypoint onLoad. So if you never leave the waypoint onLoad, then the profile onLoad will never run, as n the case of the commandline.xml file.

I'm not sure why it's done like that. There's probably a reason. Maybe the waypoint file needs to be loaded first so if there is code in the profile onLoad that deals with waypoint file, it'll work. Maybe we could change the order things run. Something like; load profile and load profile onLoad, load waypoint file and load waypointfile onLoad, run profile onLoad, run waypointfile onLoad. Does that make sense?
  • 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

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest