How to check amount of experience

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
Mushroomstamp
Posts: 210
Joined: Wed Oct 27, 2010 11:34 am

How to check amount of experience

#1 Post by Mushroomstamp » Thu Aug 04, 2011 1:24 pm

What code can I use to get my character to do something if he gets above x experience, (cumulative total or current level)? This is mid-level so player.Level and onLevelUp won't work.

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

Re: How to check amount of experience

#2 Post by Administrator » Thu Aug 04, 2011 8:10 pm

player.LastExp contains your total exp (if I remember correctly). It updates every 10 seconds, so is reasonably accurate.

Mushroomstamp
Posts: 210
Joined: Wed Oct 27, 2010 11:34 am

Re: How to check amount of experience

#3 Post by Mushroomstamp » Thu Aug 04, 2011 10:46 pm

Awesome, thanks. Can I force an update with player:update() or anything else?

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

Re: How to check amount of experience

#4 Post by rock5 » Fri Aug 05, 2011 12:39 am

You can't really force an update but you could read the value directly yourself. This is the command

Code: Select all

experience = memoryReadRepeat("intptr", getProc(), addresses.charExp_address, 0)
  • 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

Mushroomstamp
Posts: 210
Joined: Wed Oct 27, 2010 11:34 am

Re: How to check amount of experience

#5 Post by Mushroomstamp » Fri Aug 05, 2011 8:40 am

Sweet... so I need to put;

Code: Select all

local experience = memoryReadRepeat("intptr", getProc(), addresses.charExp_address, 0)
in onLoad, then I can use statements like;

Code: Select all

if experience > 600000 then
     __WPL:setForcedWaypointType("RUN")
end
correct?

Or would it be better to do a function like;

Code: Select all

		function getXP
			return memoryReadRepeat("intptr", getProc(), addresses.charExp_address, 0)
		end

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

Re: How to check amount of experience

#6 Post by rock5 » Fri Aug 05, 2011 8:58 am

It would have to be a function. The first idea wouldn't work. Make sure you start it with

Code: Select all

 function getXP()
not

Code: Select all

 function getXP
Then you could use

Code: Select all

if getXP() > 600000 then
     __WPL:setForcedWaypointType("RUN")
end
  • 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

Mushroomstamp
Posts: 210
Joined: Wed Oct 27, 2010 11:34 am

Re: How to check amount of experience

#7 Post by Mushroomstamp » Fri Aug 05, 2011 9:08 am

Lol at forgot the parentheses. :oops: Thanks so much!

Mushroomstamp
Posts: 210
Joined: Wed Oct 27, 2010 11:34 am

Re: How to check amount of experience

#8 Post by Mushroomstamp » Fri Aug 05, 2011 11:06 am

For anyone that doesn't know;

Code: Select all

memoryReadRepeat("intptr", getProc(), addresses.charExp_address, 0)
gives current level experience, not a cumulative total. I did not test player.LastExp.

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

Re: How to check amount of experience

#9 Post by rock5 » Mon Aug 15, 2011 2:37 am

I just added player.XP and player.TP to the latest revision. They get updated when player:update() is run.

note: This revision also adds player.Class3 and player.Level3 values.
  • 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

Who is online

Users browsing this forum: No registered users and 2 guests