Page 1 of 1

alternative Merchant-waypoint

Posted: Sat Mar 20, 2010 7:10 am
by nofuture
Hiho,

I want to add to my profile/waypoint an alternative waypoint, if i have more then x items in my bag or the durabily of my armor/weapon is too low.
On the wiki-page i´ve read all i need, but it still don´t get back on the "main-waypoint"

this is my code (first i had the code in the profile in the onload-tag, now in the waypoint without onload - both works):

Code: Select all

<waypoints>
inventory:update();
occupiedSlots, totalSlots = sendMacro("GetBagCount();");

	if( occupiedSlots > 60 ) then
		printf( occupiedSlots );
		loadPaths( "waypoint_merchant" );
	end;
<!-- #  1 --><waypoint x="-..." z="...">	</waypoint>
</waypoints>
in the micromacro-window it show me for example "63" at start and say that it loads "waypoint_merchant.xml".
If the Merchant-Waypoint ends, i have at the end of "waypoint_merchant.xml" linked back:

Code: Select all

<waypoints type="TRAVEL">
	<!-- #  1 --><waypoint x="-..." z="..." type="NORMAL">	</waypoint>
...
loadPaths( "waypoint" );
</waypoints>
But after the bot arrived the end of "waypoint_merchant.xml" it restart the merchant-waypoint and don´t load the main-waypoint to make the check to farm the main-waypoint :(

someone know that problem and can tell me, what could be wrong?

thx

nofuture

Re: alternative Merchant-waypoint

Posted: Sat Mar 20, 2010 9:15 am
by Administrator
loadPaths( "waypoint" );
</waypoints>
There's your problem. The loadPaths() call must be inside a waypoint tag, otherwise it wouldn't know when to call it.

Re: alternative Merchant-waypoint

Posted: Sat Mar 20, 2010 2:50 pm
by nofuture
thank you,
you´re right, that was the problem.
now it works :-)

Re: alternative Merchant-waypoint

Posted: Sun Mar 21, 2010 5:09 am
by rock5
I never realised you could put code outside of waypoint tags.

Does that get executed when the waypoint file is loaded?

Why haven't I ever seen that mentioned before?

That's perfect for changing profile setting to match the waypoint file.

For instance I used to put 'settings.profile.mobs = {"Beetle"};' in a waypoint tag of a waypoint file for killing beetles, but I could just leave it outside of tags so it gets executed as soon as the file is loaded?

Re: alternative Merchant-waypoint

Posted: Sun Mar 21, 2010 10:17 am
by Administrator

Code: Select all

I never realised you could put code outside of waypoint tags.
You can't. It won't generate an error, but it also won't do anything.

Re: alternative Merchant-waypoint

Posted: Sun Mar 21, 2010 5:37 pm
by rock5
Administrator wrote:

Code: Select all

I never realised you could put code outside of waypoint tags.
You can't. It won't generate an error, but it also won't do anything.
Doesn't the first block of code above have some code outside of waypoint tags?

You only corrected him on the loadpaths being outside of tags? And he indicated, once he fixed that, that it worked?

Re: alternative Merchant-waypoint

Posted: Sun Mar 21, 2010 6:55 pm
by Administrator
That code should also not do anything. If it did, that would be a bug.

Re: alternative Merchant-waypoint

Posted: Sun Mar 21, 2010 8:46 pm
by rock5
It would be cool if you could use something like 'onload' tags with waypoint files. Any chance that could be implemented?

Re: alternative Merchant-waypoint

Posted: Mon Mar 22, 2010 6:45 pm
by Administrator
rock5 wrote:It would be cool if you could use something like 'onload' tags with waypoint files. Any chance that could be implemented?
You can with r428.

Code: Select all

<waypoints>
     <onLoad>doSomething();</onLoad>
</waypoints>

Re: alternative Merchant-waypoint

Posted: Mon Mar 22, 2010 7:08 pm
by rock5
Administrator wrote:
rock5 wrote:It would be cool if you could use something like 'onload' tags with waypoint files. Any chance that could be implemented?
You can with r428.

Code: Select all

<waypoints>
     <onLoad>doSomething();</onLoad>
</waypoints>
Oh cool. Excellent!

Thank you sooo much.

Re: alternative Merchant-waypoint

Posted: Wed Mar 24, 2010 6:25 pm
by unicron
I had been wondering exactly how to integrate filled bag slots with my waypoints and the onload. Useful thread.