Get player position in OnLoad

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
ZZZZZ
Posts: 513
Joined: Sun Oct 21, 2012 1:42 am

Get player position in OnLoad

#1 Post by ZZZZZ » Wed Sep 25, 2013 12:02 pm

Have tried searching around for anything related to it but unsuccessful so far...

Basically just want to load the player position within the onload of a waypoint rather than using Get_Player_Position.bat manually and put the values into playerX-playerY-playerZ which would then go into the waypoint.

example:

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>
 
<OnLoad>

 Get position (playerX playerY playerZ)

</OnLoad>

	<!-- #  1 --><waypoint x="playerX" z="playerZ" y="playerY">
    repeat
        yrest(1)
        player:update()
        until player.Battling or player:findEnemy(nil,nil,evalTargetDefault)
    </waypoint>
</waypoints>
Would make it far easier to move around to a different location when farming cards etc.

Any info would be great...and sorry if its obvious in another thread..havnt been able to find anything ^.^

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

Re: Get player position in OnLoad

#2 Post by rock5 » Wed Sep 25, 2013 3:17 pm

First consider using wander mode with a radius of 0 or my rbassist waypoint file.

But if you want to use your own file and you want it to keep to a certain location then you can do away with the waypoint and just use the onload.

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>
<OnLoad>
local playerX, playerY, playerZ = player.X, player.Y, player.Z
while true do
   -- Wait for mob
   repeat
        yrest(1)
        player:update()
   until player.Battling or player:findEnemy(nil,nil,evalTargetDefault)
   -- Fight till there are no more mobs
   enemy = player:findEnemy(nil,nil,evalTargetDefault)
   while enemy do
        player:target(enemy)
        player:fight()
        enemy = player:findEnemy(nil,nil,evalTargetDefault)
   end
   -- Return to starting position
   player:moveTo(CWaypoint(playerX,playerZ,playerY), true)
end
</OnLoad>
</waypoints>
I think that should work.
  • 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

ZZZZZ
Posts: 513
Joined: Sun Oct 21, 2012 1:42 am

Re: Get player position in OnLoad

#3 Post by ZZZZZ » Thu Sep 26, 2013 9:11 pm

Works correctly, thanks :)

Post Reply

Who is online

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