Skipped waypoints

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Skipped waypoints

#1 Post by rock5 »

I've noticed, in some situations, that waypoints get skipped when they shouldn't.

I've now done a few tests to see under what conditions this happens. I've found 2.
  • 1st. When you use loadpaths you get a message saying something like "Point #3 is closer than Point #1 so we will start with point #3". The point 3 would be the closest but it goes to the next point instead, skipping 3 altogether.
  • 2nd. When using __WPL:setWaypointIndex(9), instead of going to waypoint 9 it goes to 10.
In both these situations you should always go to the closest waypoint first. I'm not sure why it skips them.

I know that in most waypoint files this wont cause too much trouble but there are situations where it can completely screw up the planned progression of your waypoint files.

I hope this can be fixed.
  • 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
Administrator
Site Admin
Posts: 5353
Joined: Sat Jan 05, 2008 4:21 pm

Re: Skipped waypoints

#2 Post by Administrator »

Line 444 of rom/functions.lua has this:

Code: Select all

		__WPL:setWaypointIndex(__WPL:getNearestWaypoint(player.X, player.Z));
Change to:

Code: Select all

		local wpi = __WPL:getNearestWaypoint(player.X, player.Z);
		if( wpi == 1 ) then wpi = #__WPL.Waypoints else wpi = wpi - 1; end;
		__WPL:setWaypointIndex(wpi);
That should get you moving to the closest waypoint properly. Let me know if this works.

The CWaypoint:setWaypointIndex() is working as intended. It's not to set which waypoint you want to move to, but rather, which waypoint you are moving from.
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Skipped waypoints

#3 Post by rock5 »

Administrator wrote:Line 444 of rom/functions.lua has this:

Code: Select all

		__WPL:setWaypointIndex(__WPL:getNearestWaypoint(player.X, player.Z));
Change to:

Code: Select all

		local wpi = __WPL:getNearestWaypoint(player.X, player.Z);
		if( wpi == 1 ) then wpi = #__WPL.Waypoints else wpi = wpi - 1; end;
		__WPL:setWaypointIndex(wpi);
That should get you moving to the closest waypoint properly. Let me know if this works.
Seems to work, yes. Thank you.
Administrator wrote:The CWaypoint:setWaypointIndex() is working as intended. It's not to set which waypoint you want to move to, but rather, which waypoint you are moving from.
That's in contradiction of everything I've read and seems counter intuitive.
http://www.solarstrike.net/wiki/index.p ... _Functions states:

Code: Select all

__WPL:setWaypointIndex( number);
Set the waypoint # 'number' as next waypoint to reach
It is also accepted, I believe, that to set the nearest waypoint as the next waypoint manually you would use;

Code: Select all

__WPL:setWaypointIndex(__WPL:getNearestWaypoint(player.X, player.Z))
Correct?

According to you then, it should be;

Code: Select all

__WPL:setWaypointIndex(__WPL:getNearestWaypoint(player.X, player.Z)-1)
I'm sure that would confuse a lot of people.

What do you think?
  • 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
Administrator
Site Admin
Posts: 5353
Joined: Sat Jan 05, 2008 4:21 pm

Re: Skipped waypoints

#4 Post by Administrator »

The bot will always try to move to __WPL:getNextWaypoint(), which is CurrentIndex + 1. To change that would require a lot of editing. It might not seem like a big deal, but remember that there are several times when it would need to return to the last reached waypoint rather than continue forward. It could cause a lot of unforseen bugs to change just CWaypointList:getNextWaypoint() and __WPL:setWaypointIndex().

Code: Select all

__WPL:setWaypointIndex(__WPL:getNearestWaypoint(player.X, player.Z)-1)
Generally, yes. But there's got to be a special case to loop around from 1 to the last waypoint in the list.
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Skipped waypoints

#5 Post by rock5 »

Should I be using __WPL:getNextWaypoint() somehow?

Isn't the next waypoint stored anywhere? Isn't there anyway to just set the next waypoint instead of using the previous waypoint?

Maybe you could create a __WPL:setNextWaypointIndex function that works out and sets __WPL:setWaypointIndex() correctly?

That shouldn't be too difficult to do.
  • 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
Administrator
Site Admin
Posts: 5353
Joined: Sat Jan 05, 2008 4:21 pm

Re: Skipped waypoints

#6 Post by Administrator »

It's easier to just work around it so that we don't have to worry about fixing any additional bugs. A new function specifically for this could be added, though:

Code: Select all

function CWaypoint:setCurrentWaypoint(wpi)
      if( wpi == 1 ) then wpi = #__WPL.Waypoints else wpi = wpi - 1; end;
      __WPL:setWaypointIndex(wpi);
end
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Skipped waypoints

#7 Post by rock5 »

Administrator wrote:It's easier to just work around it so that we don't have to worry about fixing any additional bugs. A new function specifically for this could be added, though:

Code: Select all

function CWaypoint:setCurrentWaypoint(wpi)
      if( wpi == 1 ) then wpi = #__WPL.Waypoints else wpi = wpi - 1; end;
      __WPL:setWaypointIndex(wpi);
end
Yes, that's exactly what I meant.

So you'd use it like this to take you to the nearest waypoint;

Code: Select all

__WPL:setCurrentWaypoint(__WPL:getNearestWaypoint(player.X, player.Z))
Right?

Are you going to implement it or do you want me to test it first?

If you want me to test it, where should I put it?
  • 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
Administrator
Site Admin
Posts: 5353
Joined: Sat Jan 05, 2008 4:21 pm

Re: Skipped waypoints

#8 Post by Administrator »

Test it. Just put it in rom/classes/waypointlist.lua outside of any other function.
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Skipped waypoints

#9 Post by rock5 »

rock5 wrote:
Administrator wrote:Line 444 of rom/functions.lua has this:

Code: Select all

		__WPL:setWaypointIndex(__WPL:getNearestWaypoint(player.X, player.Z));
Change to:

Code: Select all

		local wpi = __WPL:getNearestWaypoint(player.X, player.Z);
		if( wpi == 1 ) then wpi = #__WPL.Waypoints else wpi = wpi - 1; end;
		__WPL:setWaypointIndex(wpi);
That should get you moving to the closest waypoint properly. Let me know if this works.
Seems to work, yes. Thank you.
I spoke too soon. With this fix it correctly moves to the closest waypoint when using loadpaths but when you start the first waypoint file it moves to the closest point -1 first.
  • 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: Skipped waypoints

#10 Post by rock5 »

Revision 431 did not fix it.

As stated in the above post, when 1 waypoint file loads another waypoint file with the loadpaths command then it correctly moves to the closest point but when you load your first waypoint file it starts from the point before the closest point.

So in fixing loadpaths you broke loading the first file which was working correctly in revision 430.
  • 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