• You've discovered RedGuides, an EverQuest multi-boxing and scripting community 🧙‍♀️⚙️. We want you to play several EQ characters at once, come join us and say hello! 👋

  • A TLP without truebox has thawed (Very Vanilla ready)
    Frostreaver

Question - Calculating AA Exp.

Soandso2

Well-known member
Joined
Mar 13, 2023
RedCents
937¢
When you kill a mob and get regular exp, the game tells you in the "you gain experience" emote exactly how much exp you got. But when you get AA experience, it just says "you gain experience", so I wanted to make a little calculation telling me exactly how much AA experience you got. This is a bit tricky, since it is quite possibe to get several hundred percent exp. Killing a mob in the later expansions of the game can, with exp bonus, seasonal bonuses etc can give 3 AAs for a kill.

This is how I solved it:
[CODE lang="Lua" title="Calculating AA Experience" highlight="4"]local function aaExperience()
local newAAExp = tonumber(me.AAPointsTotal().."."..me.AAExp())
local aaExpReceived = string.format("%.3f", (newAAExp - currentAAExp)*100)
--print (newAAExp.."-"..currentAAExp)
local expleft = string.format("%.3f", (100000-me.AAExp())/1000)
currentAAExp = newAAExp
printf("\atExperience:\ax: \ay%s%%\ax, just \ay%s%%\ax to go! Total: \at%s AAs\ax",aaExpReceived,expleft,me.AAPoints())
end[/CODE]

Now, this works 99% of the time, but sometimes I see strange behaviour, where the calculation gives negative experience, or too much.
Finally I grew weary of seeing incorrect values from time to time, so I added line 4 for debugging, and soon enough I saw this:

3945.9004999999-3944,4904399999
and the message that I got 141% experience.
I found this to be strange and looked at my AA window, where it said that I had 9 (nine) something percent of an AA, not 90% as the above states.

I realise that the code is flawed also because if I have less than 10% AA exp, I need to figure out how to add a starting 0 (since the above ought to be 3945.09004, not 3945.90049 or 3945.9004999999)

But the major problems seems to be that something happens that changes the AA exp as a raw number out of 10,000 (10,000=100%) to a ten digit value, regardless of how much AA exp I have. Why is this? When testing this in an online Lua sandbox, like so:

Lua:
local a = 55
local b = 2998

local str = tonumber(a.."."..b)

print (str)

it does not happen.
 
Last edited:
When you kill a mob and get regular exp, the game tells you in the "you gain experience" emote exactly how much exp you got. But when you get AA experience, it just says "you gain experience", so I wanted to make a little calculation telling me exactly how much AA experience you got. This is a bit tricky, since it is quite possibe to get several hundred percent exp. Killing a mob in the later expansions of the game can, with exp bonus, seasonal bonuses etc can give 3 AAs for a kill.

This is how I solved it:
[CODE lang="lua" title="Calculating AA Experience" highlight="4"]local function aaExperience()
local newAAExp = tonumber(me.AAPointsTotal().."."..me.AAExp())
local aaExpReceived = string.format("%.3f", (newAAExp - currentAAExp)*100)
--print (newAAExp.."-"..currentAAExp)
local expleft = string.format("%.3f", (100000-me.AAExp())/1000)
currentAAExp = newAAExp
printf("\atExperience:\ax: \ay%s%%\ax, just \ay%s%%\ax to go! Total: \at%s AAs\ax",aaExpReceived,expleft,me.AAPoints())
end[/CODE]

Now, this works 99% of the time, but sometimes I see strange behaviour, where the calculation gives negative experience, or too much.
Finally I grew weary of seeing incorrect values from time to time, so I added line 4 for debugging, and soon enough I saw this:

3945.9004999999-3944,4904399999
and the message that I got 141% experience.
I found this to be strange and looked at my AA window, where it said that I had 9 (nine) something percent of an AA, not 90% as the above states.

I realise that the code is flawed also because if I have less than 10% AA exp, I need to figure out how to add a starting 0 (since the above ought to be 3945.09004, not 3945.90049 or 3945.9004999999)

But the major problems seems to be that something happens that changes the AA exp as a raw number out of 10,000 (10,000=100%) to a ten digit value, regardless of how much AA exp I have. Why is this? When testing this in an online lua sandbox, like so:

Lua:
local a = 55
local b = 2998

local str = tonumber(a.."."..b)

print (str)

it does not happen.
not meant as a discouragement for your project, but you are familiar with mq2xptracker right?
 
not meant as a discouragement for your project, but you are familiar with mq2xptracker right?
No I am not, but I will find out now that I know about it. Often I just want to solve what appears to be an easy task myself. But sometimes what appears to be easy is not so easy.

However, is there an answer to the question? Why the five digit value of AAExp() becomes a ten digit number once I use it the way I do?

Edit: Well, now knowing about the plugin, I removed my own code from the Lua all together. Thanks for the advice. But I am still curious why the above problem occurred.
 
Last edited:
Question - Calculating AA Exp.

Users who are viewing this thread

Back
Top
Cart