Questions re waypointlist and other stuff

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
Jandrana
Posts: 187
Joined: Thu Jul 05, 2012 5:53 am

Questions re waypointlist and other stuff

#1 Post by Jandrana » Tue Jul 24, 2012 4:10 am

Just working on a script to do the butterfly dailies. To make the script behave like a real player, it needs to do different things depending on which part of the waypoint list the char currently is. I was looking for a way to determine the current waypoint index in my code, but didn't find anything. Currently I've extended the waypointlist.lua this way:

Code: Select all

function CWaypointList:getWaypointIndex()
	return self.CurrentWaypoint;
end
Did I miss a something to do this any other way? If not, could you add this new function in the next release?

---
Second question:
In the player profile there is an section to define code when leaving combat:
<onLeaveCombat><![CDATA[
-- Additional Lua code to execute after killing an enemy
]]></onLeaveCombat>
I tried to use this section in my waypoint script too. But currently without success. Adding code for a specific script to onLeaveCombat in the profile file, is not a viable solution.

What I like to do: if the char is on the way from quest giver to the laby and is being attacked, it should kill the mob. After leaving combat, it should mount it's horse again. Currently I've added a function at each waypoint that checks if being mounted, but this is crude and not like I wanted it to be. Any comments how to do this?

Jandrana
Posts: 187
Joined: Thu Jul 05, 2012 5:53 am

Re: Questions re waypointlist and other stuff

#2 Post by Jandrana » Tue Jul 24, 2012 4:30 am

Maybe I found a solution for my 2nd question myself.

Overriding the onLeaveCombat function this way:

Code: Select all

settings.profile.events.onLeaveCombat = function()
   -- do something
end
Correct me, if I'm wrong.

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Questions re waypointlist and other stuff

#3 Post by lisa » Tue Jul 24, 2012 5:02 am

Code: Select all

local wpoint = CWaypointList();
print(wpoint.CurrentWaypoint)
that will print the current waypoint number you are on in the file.

Things you can use are

Code: Select all

Radius: 
OrigX: 
Type:   
ForcedType:     
ExcludeZones:   table
CurrentWaypoint:        
LastWaypoint:   
Waypoints:      table
KillZone:       table
Mode:   
Direction:      
OrigZ: 
and yes

Code: Select all

settings.profile.events.onLeaveCombat = function()
   -- do something
end
will override any onleavecombat code in your profile.
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
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Questions re waypointlist and other stuff

#4 Post by lisa » Tue Jul 24, 2012 5:42 am

actually it is already defined in functions.lua

Code: Select all

__WPL.CurrentWaypoint
is all you need.
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: Questions re waypointlist and other stuff

#5 Post by rock5 » Wed Jul 25, 2012 1:33 pm

lisa wrote:actually it is already defined in functions.lua

Code: Select all

__WPL.CurrentWaypoint
is all you need.
I was about to say. :?

I word about __WPL.CurrentWaypoint. When you are walking to a waypoint, the one you are walking to is the currentwaypoint. When you reach the waypoint and start to execute any code there, currentwaypoint is now the next waypoint. The waypoint you are currently at will be __WPL.LastWaypoint.
  • 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

Jandrana
Posts: 187
Joined: Thu Jul 05, 2012 5:53 am

Re: Questions re waypointlist and other stuff

#6 Post by Jandrana » Thu Jul 26, 2012 6:16 am

I word about __WPL.CurrentWaypoint. When you are walking to a waypoint, the one you are walking to is the currentwaypoint. When you reach the waypoint and start to execute any code there, currentwaypoint is now the next waypoint. The waypoint you are currently at will be __WPL.LastWaypoint.
Thanks for this! Maybe this explains some oddness in my butterfly script. Will change to __WPL.LastWaypoint and see if it gets better.

Another thing:

I changed the onLeaveCombat function to my needs and I'd like to do two things after leaving combat:
1.) loot dead mobs
2.) mount horse

Currently my onLeaveCombat only mounts a horse, because I expected looting being done by the bot. But the loot code done by the bot happens after calling onLeaveCombat function. In my case this causes my char to dismount.

Is it safe to call "player:loot()" or "player:lootAll" in onLeaveCombat, or will this cause trouble with the loot code done by the bot?

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

Re: Questions re waypointlist and other stuff

#7 Post by rock5 » Thu Jul 26, 2012 6:37 am

Both should work I 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

Jandrana
Posts: 187
Joined: Thu Jul 05, 2012 5:53 am

Re: Questions re waypointlist and other stuff

#8 Post by Jandrana » Fri Jul 27, 2012 7:04 am

I have two issues with my butterfly script and I'm looking for hints and solutions:

First thing is a general thing, how the bot processes waypoints. If the bot should kill and loot mobs, it moves away from the defined waypoints. There is a logic to determine the closest waypoint and so the bot will try to walk a new route to the next waypoint. This way it can happen, that the char will get stuck somewhere, because an obstacle prevents reaching the closest waypoint from the current position. Currently there is internal logic to unstuck the player and logout if this does not work after 10 tries.

I would suggest two things here:
- when determining the next closest waypoint, the Z difference should be used to determine the slope between the current char position and the next waypoint. If the slope exceeds a certain value, the bot should use a "backtrack" list (see next point).

- the bot should maintain a queue with the last 2-3 visited waypoints - (may be also add dynamic positions - like the position where you had looted, killed the last mob).

First thing should prevent, that the bot tries to run against ascending slopes several times (which looks quite bottish). The backtrack list should prevent, that the bot gets stuck. If the backtrack list leads the character back to a position that is assigned to a waypoint, the bot should be able to recover (if the waypoints are not bullshit).

----

The second thing is a strange thing, that happens in my butterfly script. The first part of this script is plain list of waypoints from the quest NPC to the labyrinth, where the butterflies spawn. In ~9 out of 10 runs, everthing is ok. But sometimes it happens, that the bot gets stuck, because he misses on of the portals or falls off the ramp at the end of the first gangway. In the MM windows he prints the correct waypoint, but my assumption is, that internally he is calculating a route to the next but one waypoint. Any ideas, how this can happen? Better, how to prevent this?

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Questions re waypointlist and other stuff

#9 Post by lisa » Fri Jul 27, 2012 8:02 am

The bot doesn't keep track of your locations as you travel, if it did there would be 1000's of stored coords every minute, that is why we create our own set of coords to follow with the waypoint files.
Jandrana wrote: the Z difference should be used to determine the slope between the current char position and the next waypoint. If the slope exceeds a certain value, .
Issue is that not everyone follows the rules of not being able to go directly up (flying or wall climbing), I know I have done it in a few of my waypoints so to make it default bot behaviour to not go in a direction would be limiting.

I will attach my leacher WP for butterflies, I am sure it is posted elsewhere but I'm not going to look for it.
buttleach.xml
(1.78 KiB) Downloaded 194 times
If you want it to kill then just add in more sets of coords for the killing part.

Another thing you might appreciate is that the default bot has inbuilt into it adaptability for people to do their own unstick codes at 3,6,9 unstick tries.
Just create a function with the name
unStick3()
unStick6()
unStick9()
and those functions will be performed at the unstick tries of 3,6,9.
You can create 1,all or none of them, it's up to you.
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

Jandrana
Posts: 187
Joined: Thu Jul 05, 2012 5:53 am

Re: Questions re waypointlist and other stuff

#10 Post by Jandrana » Fri Jul 27, 2012 8:49 am

The bot doesn't keep track of your locations as you travel, if it did there would be 1000's of stored coords every minute
If it is done a smart way, it should be no problem. I would only add locations to a queue, if you had moved a certain distance. Of course the queue should have a limit - as I wrote: may be only ~3.
to make it default bot behavior to not go in a direction would be limiting.
There could be an option to disable it, if you like to do things like swimhack or similar.
If you want it to kill then just add in more sets of coords for the killing part.
As I wrote, my butterfly bot works 90% of the time. Maybe I should add more waypoints for the route from quest NPC to the butterfly spawn location, which could reduce the problem getting stuck on this route.

Thanks for your comments and pointing me to the unstick() functions. Perhaps I will try to modify the bot code myself and include my ideas and see if there is any improvement.

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Questions re waypointlist and other stuff

#11 Post by lisa » Fri Jul 27, 2012 9:01 am

Jandrana wrote:I would only add locations to a queue, if you had moved a certain distance. Of course the queue should have a limit - as I wrote: may be only ~3.
The bot is updating player coords very very very often, that is why I said 1000's per minute, it constantly does distance checks to many things and each time it updates the player coords. Moving to a waypoint or fighting mobs
the coords are updated constantly.
Jandrana wrote:Perhaps I will try to modify the bot code myself and include my ideas and see if there is any improvement.
You are welcome to try, just keep in mind what might work really well for one WP might be really bad for others ;)
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: Questions re waypointlist and other stuff

#12 Post by rock5 » Fri Jul 27, 2012 9:28 am

lisa wrote:
Jandrana wrote:I would only add locations to a queue, if you had moved a certain distance. Of course the queue should have a limit - as I wrote: may be only ~3.
The bot is updating player coords very very very often, that is why I said 1000's per minute, it constantly does distance checks to many things and each time it updates the player coords. Moving to a waypoint or fighting mobs
the coords are updated constantly.
Actually, to be able to back track all you would need to do is record the coords of the destination of each moveTo. So between 2 waypoints you might attack a couple of mobs and it would record the coords it moved to to engage in combat with them. Then if it gets stuck it could backtrack to those 2 positions then back to the last waypoint. Then go forward from there. Problems with this are; you could also end up moving during combat so you would have to take that into account, if this is not the first thing that is tried you might be out of position to backtrack, if you attacked a lot of mobs between waypoints going back a few steps might not put you in a position to get to the nearest waypoint anyway.

Probably the best solution is to just use an unstick function and decide the best steps to take to get back on track, although I would be surprised if most of the time it doesn't already manage it on it's own.
  • 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

Jandrana
Posts: 187
Joined: Thu Jul 05, 2012 5:53 am

Re: Questions re waypointlist and other stuff

#13 Post by Jandrana » Sun Jul 29, 2012 3:25 am

I have discovered the reason, why my butterfly script gets stuck sometimes. This happens when you are entering combat. The bot prints "waiting for aggressive" enemies. During this time (1-2s maybe), the bot does not check if a new waypoint has been reached, but the char continues to move. So it can happen, that you leave the waypoint path on a "critical" point, which can lead to stuck problems.

Any ideas how to avoid, maybe fix it?

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Questions re waypointlist and other stuff

#14 Post by lisa » Sun Jul 29, 2012 3:52 am

Jandrana wrote:The bot prints "waiting for aggressive" enemies.
That means something has attacked you first, so you were probably not trying to kill it yourself, so it is not within the profile settings that you want to kill or you have waypoint type as RUN.
Change waypoint type to travel and just keep going, ignoring the mob.

Code: Select all

type="TRAVEL"
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

Jandrana
Posts: 187
Joined: Thu Jul 05, 2012 5:53 am

Re: Questions re waypointlist and other stuff

#15 Post by Jandrana » Mon Jul 30, 2012 3:19 am

Thanks, Lisa.

Yes, I had waypoint type "RUN".

I never thought, that waypoint processing is affected by this. I consider this as a bug. Maybe it is not possible to do it differently, but still.

I switched to type "TRAVEL" now, and the first 10 daily runs worked without getting stuck. Sad it has to be this way, because I'd like to collect some dog meat on the way. But at least it seems to work now without getting stuck.

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Questions re waypointlist and other stuff

#16 Post by lisa » Mon Jul 30, 2012 3:44 am

The issue is just for that area, you get an aoe damage from the mobs near the black orb things and it puts you in combat even though they arn't attacking you.
So you could make it travel for going past them and then make it normal when at the straight section where dogs are.
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

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 0 guests