• Hail, we're RedGuides. We want you to play six (yes, 6!) EverQuest characters at once. We have scripts and a friendly community to help, please join our playstyle and say hello! 👋
  • We've added LLM sections to our Terms & Rules and Resource Rules, for everyone's sanity & in-game safety.
    Read more
    a. Do not replace your voice with an LLM. This goes for your posts and your scripts. Drafting and editing with a tool is fine, but don't take you out of what you share.
    b. Do not replace your EQ character's voice with an LLM. We don't want scripts that speak over /ooc, /shout or other public channels. This has been an unwritten rule that's kept casino scripts off the site for decades, but we're now compelled to make it clear: keep automated communication private.

    Why Does RG Review Scripts?
    Nearly every LLM-written Lua script we see is making your character do impossible things, and rarely in a way that's beneficial to you. We've seen heavy server hammering, /target over impossible distances when /nav spawn would passively accomplish the same thing, a spawn search that fires 20+ times per second, and other pointless actions that are likely annoying GMs.

    You are welcome to use LLMs as a tool to structure, draft, and edit your work, but please read critically before hitting /lua run

Question - Calculating AA Exp.

Soandso2

Well-known member
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:
Calculating AA Experience
Lua:
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

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:
Calculating AA Experience
Lua:
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

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