onWaypoint

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
dx876234
Posts: 188
Joined: Sat Jul 24, 2010 6:13 am

onWaypoint

#1 Post by dx876234 »

Something I've been missing for a while is an onWaypoint event, ie to be able to specify code that would trigger on each waypoint unless there is a coded action in which would override. I use it for boss proximity checking or to code actions in wander waypoint files.

It turned out rather simple to make the event, I haven't looked into reading it from config file though.

Changes necessarily is below (in bot.lua approx line 760)

regards
-f

Code: Select all

				else
					__WPL:advance();
					-- Execute it's action, if it has one.
					if( wp.Action and type(wp.Action) == "string" and string.find(wp.Action,"%a") ) then
						keyboardRelease( settings.hotkeys.MOVE_FORWARD.key ); yrest(200) -- Stop moving
						local actionchunk = loadstring(wp.Action);
						assert( actionchunk,  sprintf(language[150], __WPL.CurrentWaypoint) );
						actionchunk();
                                        -- Start onWaypoint code
					else
						if( type(settings.profile.events.onWaypoint) == "function" ) then
							local status,err = pcall(settings.profile.events.onWaypoint);
							if( status == false ) then
								local msg = sprintf("onWaypoint error: %s", err);
								error(msg);
							end
						end
					end
                                        -- end onWaypoint code
				end
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: onWaypoint

#2 Post by rock5 »

I think the reason it was never implemented was because if you want something checked on a regular basis then you can use a timer event and in most cases it would work better.

But if we did have an onwaypoint event I would think that it should run regardless if there is actual code at the waypoint. It should run at every waypoint.
  • 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
dx876234
Posts: 188
Joined: Sat Jul 24, 2010 6:13 am

Re: onWaypoint

#3 Post by dx876234 »

Ye, I pretty much agree to that, make it run every waypoint - but before or after coding in waypoint?

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

Re: onWaypoint

#4 Post by rock5 »

I don't know. What uses is it likely to be used for? I can think of one. Instead of putting player:harvest() at every waypoint it would be simpler to just add it to the onwaypoint.
  • 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: onWaypoint

#5 Post by lisa »

I dabled in having player:harvest() much more frequently, it made the bot very slow. Not something I would add to bot as default behaviour.
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
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: onWaypoint

#6 Post by rock5 »

I guess it's because it would stop at every waypoint. Wouldn't be much of an issue if you took care not to make too many waypoints and keep them far apart between nodes.

That would be an issue to deal with though, as any code at waypoints makes it stop. Of course any code in the onwaypoint would be separate and probably we would have to decide if we want it to stop at every waypoint or not. I say no but then if the code in the onwaypoint requires the character to stop then the user would have to include a stop. Maybe we would have to add a 'stopmoving' function to simplify it for users.
  • 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