Page 1 of 1

howto change path in onload section?

Posted: Tue Feb 09, 2010 5:44 pm
by depp69
hello there,

im trying to load some paths at onload-profile-section:
thats what i tried so far:

Code: Select all

	<onLoad>
	
		if(player.level == 2) then
			loadPaths("my110/l2-3_wolf");
		end;
		if(player.level == 3) then
			loadPaths("my110/l3-4_bear");
		end;
		if(player.level == 4) then
			loadPaths("my110/l3-4_bear");
		end;

	</onLoad>
but it still loads the default path :(
is there any way to get this working?

greetings depp

Re: howto change path in onload section?

Posted: Tue Feb 09, 2010 8:01 pm
by Administrator
That's because the path set in your profile will be loaded after the profile is loaded, as per the documentation. It makes no sense to load the path in your profile before even loading the profile. You are abusing the onLoad event.

Re: howto change path in onload section?

Posted: Mon Feb 22, 2010 5:41 am
by depp69
so is this an error @ wiki:
http://www.solarstrike.net/wiki/index.p ... e_-_Events

theres also a path loaded in onload section -.-
also i read somewhere, onload can be used to overwrite profile options,
but you are saying its loaded before the profile so you cant overwrite anything ...

so what is this onload section for?

Re: howto change path in onload section?

Posted: Mon Feb 22, 2010 7:31 am
by Administrator
You're right that the wiki is wrong. You could try something, though. Open rom/bot.lua, and go to (CTRL+G) line 311. You'll see this:

Code: Select all

		if( settings.profile.options.WAYPOINTS ) then
Change to:

Code: Select all

		if( settings.profile.options.WAYPOINTS and __WPL == nil ) then
Save. It might now let you load waypoints from within the onLoad event without it being overwritten.
but you are saying its loaded before the profile so you cant overwrite anything ...
That's not quite what I said. The onLoad event is part of the profile, so it must be loaded first. Afterwards, the waypoint list from your profile is loaded (which would overwrite the current waypoint list loaded using the loadPaths() function).

Re: howto change path in onload section?

Posted: Mon Feb 22, 2010 12:24 pm
by depp69
alright, i guess this will do it, thx :)

Re: howto change path in onload section?

Posted: Tue Feb 23, 2010 12:21 pm
by d003232
Administrator wrote:You're right that the wiki is wrong.
In my opition it's not wrong. I can't remeber it 100% but I thought I did sometime a change in the coding so that it is possible to load paths within the <onLoad> event. So one can overwrite the path from the profile by using the <onLoad> event.

I suppose the error is becaus you have a typo in your coding. It should be

Code: Select all

player.Level
and not

Code: Select all

player.level
Best way to check everything if to printout the used variables in the <onLoad> event to check the content. :-)