Page 1 of 1
How to check amount of experience
Posted: Thu Aug 04, 2011 1:24 pm
by Mushroomstamp
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.
Re: How to check amount of experience
Posted: Thu Aug 04, 2011 8:10 pm
by Administrator
player.LastExp contains your total exp (if I remember correctly). It updates every 10 seconds, so is reasonably accurate.
Re: How to check amount of experience
Posted: Thu Aug 04, 2011 10:46 pm
by Mushroomstamp
Awesome, thanks. Can I force an update with player:update() or anything else?
Re: How to check amount of experience
Posted: Fri Aug 05, 2011 12:39 am
by rock5
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)
Re: How to check amount of experience
Posted: Fri Aug 05, 2011 8:40 am
by Mushroomstamp
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
Re: How to check amount of experience
Posted: Fri Aug 05, 2011 8:58 am
by rock5
It would have to be a function. The first idea wouldn't work. Make sure you start it with
not
Then you could use
Code: Select all
if getXP() > 600000 then
__WPL:setForcedWaypointType("RUN")
end
Re: How to check amount of experience
Posted: Fri Aug 05, 2011 9:08 am
by Mushroomstamp
Lol at forgot the parentheses.

Thanks so much!
Re: How to check amount of experience
Posted: Fri Aug 05, 2011 11:06 am
by Mushroomstamp
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.
Re: How to check amount of experience
Posted: Mon Aug 15, 2011 2:37 am
by rock5
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.