How do I force start at waypoint #1?

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Message
Author
randomuser01
Posts: 29
Joined: Mon Jul 19, 2010 7:32 pm

How do I force start at waypoint #1?

#1 Post by randomuser01 » Mon Aug 16, 2010 7:53 pm

Code: Select all

	<onLoad>
		__WPL:setWaypointIndex( 1);	
	</onLoad>
^ doesn't work. I'm out of ideas.

How do I make the script start at waypoint 1 no matter what waypoint it thinks is closer?

Valleyguy
Posts: 100
Joined: Wed Aug 04, 2010 11:34 pm
Location: Canada

Re: How do I force start at waypoint #1?

#2 Post by Valleyguy » Mon Aug 16, 2010 8:41 pm

randomuser01 wrote:

Code: Select all

	<onLoad>
		__WPL:setWaypointIndex( 1);	
	</onLoad>
^ doesn't work. I'm out of ideas.

How do I make the script start at waypoint 1 no matter what waypoint it thinks is closer?
Use something like the following :

Code: Select all

<onLoad>
__WPL:setWaypointIndex(__WPL:findWaypointTag("One"));
</onLoad>

<!-- #  1 --><waypoint x="-9999" z="-9999" tag="One">	</waypoint>
Image

randomuser01
Posts: 29
Joined: Mon Jul 19, 2010 7:32 pm

Re: How do I force start at waypoint #1?

#3 Post by randomuser01 » Mon Aug 16, 2010 9:54 pm

Does the exact same thing that my code does. Still just loads whatever waypoint is closest.

User avatar
Administrator
Site Admin
Posts: 5313
Joined: Sat Jan 05, 2008 4:21 pm

Re: How do I force start at waypoint #1?

#4 Post by Administrator » Mon Aug 16, 2010 11:20 pm

At line 173 of bot.lua, you'll see this:

Code: Select all

	-- onLoad event
	-- possibility for users to overwrite profile settings
	if( type(settings.profile.events.onLoad) == "function" ) then
		local status,err = pcall(settings.profile.events.onLoad);
		if( status == false ) then
			local msg = sprintf("onLoad error: %s", err);
			error(msg);
		end
	end
Move that code down to about line 381, directly above this:

Code: Select all

	-- Update inventory
	inventory:update();
Let me know if this works.

randomuser01
Posts: 29
Joined: Mon Jul 19, 2010 7:32 pm

Re: How do I force start at waypoint #1?

#5 Post by randomuser01 » Tue Aug 17, 2010 12:12 am

I'll give that a shot tomorrow, see what it spits out, thanks.

randomuser01
Posts: 29
Joined: Mon Jul 19, 2010 7:32 pm

Re: How do I force start at waypoint #1?

#6 Post by randomuser01 » Tue Aug 17, 2010 6:45 pm

Still doesn't work, not getting any errors either.

swietlowka
Posts: 316
Joined: Wed Jun 16, 2010 8:16 am

Re: How do I force start at waypoint #1?

#7 Post by swietlowka » Wed Aug 18, 2010 4:32 am

was looking fo just the same thing, had to make extra loop to make my script work, not so easy though so if its possible to make it in onload ith _WPL function it would be awsome

randomuser01
Posts: 29
Joined: Mon Jul 19, 2010 7:32 pm

Re: How do I force start at waypoint #1?

#8 Post by randomuser01 » Wed Aug 18, 2010 8:00 pm

Could really use some help with this. Trying to chain together several scripts and they all start and end on the exact same spot. So half the time a new script will load, and it will automatically set the last waypoint as next (because start and end are the same) and that means it skips that waypoint file completely.

User avatar
Administrator
Site Admin
Posts: 5313
Joined: Sat Jan 05, 2008 4:21 pm

Re: How do I force start at waypoint #1?

#9 Post by Administrator » Wed Aug 18, 2010 8:37 pm

Hold on a second. How are you trying to load these waypoint files? Are you talking about the waypoint list that is automatically loaded when you start the bot, or are you talking about the second (or third, or...) waypoint list being loaded by calling __WPL:load()?

randomuser01
Posts: 29
Joined: Mon Jul 19, 2010 7:32 pm

Re: How do I force start at waypoint #1?

#10 Post by randomuser01 » Wed Aug 18, 2010 9:44 pm

Either way.

Starting rom/bot.lua and selecting the waypoint from the list, even with the onLoad script, it will start wherever is closest.

With a new waypoint list being started using loadPaths("").

Either way, the closest waypoint is selected. I even tried loading it by creating a batch file that calls the script and waypoint directly.

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

Re: How do I force start at waypoint #1?

#11 Post by rock5 » Wed Aug 18, 2010 10:27 pm

randomuser01 wrote:Could really use some help with this. Trying to chain together several scripts and they all start and end on the exact same spot. So half the time a new script will load, and it will automatically set the last waypoint as next (because start and end are the same) and that means it skips that waypoint file completely.
Normally the last point and the first point are not the same. If I understand correctly, you need the last point to be the same because the next file starts at that location. I suggest in the future you avoid starting files in exactly the same place to avoid this problem. You could connect the files together and make 1 big file. You should then be able to control what path it takes using the __WPL commands.
  • 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

randomuser01
Posts: 29
Joined: Mon Jul 19, 2010 7:32 pm

Re: How do I force start at waypoint #1?

#12 Post by randomuser01 » Thu Aug 19, 2010 12:10 am

rock5 wrote:
randomuser01 wrote:Could really use some help with this. Trying to chain together several scripts and they all start and end on the exact same spot. So half the time a new script will load, and it will automatically set the last waypoint as next (because start and end are the same) and that means it skips that waypoint file completely.
Normally the last point and the first point are not the same. If I understand correctly, you need the last point to be the same because the next file starts at that location. I suggest in the future you avoid starting files in exactly the same place to avoid this problem. You could connect the files together and make 1 big file. You should then be able to control what path it takes using the __WPL commands.
Well, let me tell you what it's doing, and maybe you can give me some input.

My character is running dailys on his high level side, then going to the housemaid, switching classes, and then going out and turning the dailys in. I do this in blocks of 3 dailys.

So bot starts with character on high side, goes out and does 4 quests, goes to house maid and switches to low side.
Bot goes out and turns in dailies, comes back to housemaid and switches back to high side.
Bot goes out and does 3 dailys, comes back to housemaid and switches to low side.
Bot goes and turns in dailies, switches to high side.
Bot goes and does 3 dailies, switches to low side.
Bot goes and turns in 3 dailies, switches to high side and enters house.


Because the bot returns to the exact same spot so many times to switch classes, the waypoint file will never start me at waypoint #1. I have to run over to kinda where waypoint 2 and 3 are, and start the bot, and pray that I'm not accidentally too close to waypoint #180 or #323 or whatever else runs right back over that spot.

I've tried it a couple ways, with 6 separate waypoint files, 4, turn in 4, 3, turn in 3, etc... And with one massive waypoint file with nearly 600 waypoints.

Both ways are equally difficult to get the bot to start at the actual beginning of the waypoint file.

One thing I was thinking MIGHT work. Could I set some sort of flag in the OnLoad code, and have that flag do something in the profile to force the next waypoint to be #1. And then have lua code inside waypoint 1 to turn the flag off? Would that work? How would I setup the profile part of the code?

Thanks!

User avatar
Administrator
Site Admin
Posts: 5313
Joined: Sat Jan 05, 2008 4:21 pm

Re: How do I force start at waypoint #1?

#13 Post by Administrator » Thu Aug 19, 2010 6:21 am

First, update to r492. It contains the fix I posted earlier in this thread. You'll need it.

In your profile's onLoad event, you'll need:

Code: Select all

__WPL:setWaypointIndex(1);
This will take care of setting the index correctly the first time it is loaded.

Any time you use __WPL:load() to switch waypoint lists, you will also need to set the waypoint index directly after it. Now, it should be working as you want it to.

swietlowka
Posts: 316
Joined: Wed Jun 16, 2010 8:16 am

Re: How do I force start at waypoint #1?

#14 Post by swietlowka » Thu Aug 19, 2010 10:46 am

wow, thats just what i was waiting for too :D
Thanks man onload with _WPL is awsome :)

fred55555
Posts: 101
Joined: Sat Aug 07, 2010 7:57 pm

Re: How do I force start at waypoint #1?

#15 Post by fred55555 » Thu Aug 19, 2010 3:19 pm

is there a line to make you just retrace your steps instead of running back to waypoint one, wanted to make a point to point route not a circle route

User avatar
Administrator
Site Admin
Posts: 5313
Joined: Sat Jan 05, 2008 4:21 pm

Re: How do I force start at waypoint #1?

#16 Post by Administrator » Thu Aug 19, 2010 7:54 pm

You can use __WPL:setDirection("forward") or __WPL:setDirection("backward"), as well as __WPL:reverse().

randomuser01
Posts: 29
Joined: Mon Jul 19, 2010 7:32 pm

Re: How do I force start at waypoint #1?

#17 Post by randomuser01 » Fri Aug 20, 2010 2:10 am

Ran the new script and setup today and it worked flawlessly, did exactly what I wanted it to.

Thanks for the help!

fred55555
Posts: 101
Joined: Sat Aug 07, 2010 7:57 pm

Re: How do I force start at waypoint #1?

#18 Post by fred55555 » Fri Aug 20, 2010 10:18 am

You can use __WPL:setDirection("forward") or __WPL:setDirection("backward"), as well as __WPL:reverse().

so would you put this in the waypoint.xml forward at the start and backward at the end so it keeps going backand forth through the waypoints instead of looping back to waypoint 1.

User avatar
Administrator
Site Admin
Posts: 5313
Joined: Sat Jan 05, 2008 4:21 pm

Re: How do I force start at waypoint #1?

#19 Post by Administrator » Fri Aug 20, 2010 10:29 am

fred55555 wrote: so would you put this in the waypoint.xml forward at the start and backward at the end so it keeps going backand forth through the waypoints instead of looping back to waypoint 1.
Yes.

fred55555
Posts: 101
Joined: Sat Aug 07, 2010 7:57 pm

Re: How do I force start at waypoint #1?

#20 Post by fred55555 » Fri Aug 20, 2010 2:10 pm

thank you going to try it and hope i get the syntax correct. :)

thnx for help

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 3 guests