• 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 - How does the AGGRO meter works?

Yaguex

Well-known member
Let's imagine that I have an IF THEN statement in my code that will trigger certain actions if Aggro > 90.

Now, let's assume that there are multiple mobs listed in the xTarget window.

Will the actions be executed if I am aggro > 90 to ANY of the mobs in xTarget, or ONLY the top mob in the list?
 
by default it should only check against your target.

you can also specify an XTarget slot if you are building this into a macro or Lua. you would probably want to iterate over your XTarget list.
 
Yeah, I am building this into a Lua, and I would need it to check whether I am Aggro > 90 to ANY of the mobs in the XTarget list.

Any insights on how I could do that?
 
from Alert Master
Lua:
        for _, xTarEntry in ipairs(xTarTable) do
            -- Check if xTarEntry already exists in newTable
            local found = false
            for j, newEntry in ipairs(newTable) do
                if newEntry.MobID == xTarEntry.MobID then
                    -- Update newTable entry with xTarEntry data
                    newTable[j]['MobAggro'] = xTarEntry['MobAggro']
                    break
                end
            end
        end
in your case you probably aren't putting it into a table first so you can just iterate over

Lua:
    if mq.TLO.Me.XTarget() > 0 then
        for i = 1, mq.TLO.Me.XTargetSlots() do
            -- check mq.TLO.Me.XTarget(i).PctAggro()
            --if mq.TLO.Me.XTarget(i).PctAggro() meets your criteria do something
        end
    end
 
Yeah, I am building this into a Lua, and I would need it to check whether I am Aggro > 90 to ANY of the mobs in the XTarget list.

Any insights on how I could do that?
something like this
Lua:
  local function CheckAggro()
    local flag = false
         if mq.TLO.Me.XTarget() > 0 then
            for i = 1, mq.TLO.Me.XTargetSlots() do
                -- check mq.TLO.Me.XTarget(i).PctAggro()
                if mq.TLO.Me.XTarget(i).PctAggro() > 90 then
                    flag = true
                    return flag
                end
            end
        end
        return flag
    end
   
    -- use
    if CheckAggro() then
        mq.cmd('/cast %s', feignSpell)
    end
 
something like this
Lua:
  local function CheckAggro()
    local flag = false
         if mq.TLO.Me.XTarget() > 0 then
            for i = 1, mq.TLO.Me.XTargetSlots() do
                -- check mq.TLO.Me.XTarget(i).PctAggro()
                if mq.TLO.Me.XTarget(i).PctAggro() > 90 then
                    flag = true
                    return flag
                end
            end
        end
        return flag
    end
  
    -- use
    if CheckAggro() then
        mq.cmd('/cast %s', feignSpell)
    end

Thank you! one question though: I see that you have "return flag" twice inside the IF: one inside the FOR loop, and then again outside.

Any reason as of why it's twice?
 
the 2nd one is to return false if you have nothing on XTarget window or if you fail the condition checks in the for loop. the first one returns true when the conditions are met, early escape when first true value happens.
 
Simplified Aggro Check
Lua:
local function CheckAggro()
   for i = 1, mq.TLO.Me.XTarget() do
      if mq.TLO.Me.XTarget(i).PctAggro() > 90 then
         return true
      end
   end
   return false
end

I think this can be simplified to something like this.
 
You will want to validate PctAggro exists before using it. In this situation it can crash your script:

if (mq.TLO.Me.XTarget(i).PctAggro() or 0) > 90 then

This is an interesting take, but I am not sure I follow. Could you elaborate further please?
 
He's giving a default value of 0 in case of a nil value.

Pretty sure pctAggro returns a number always but it never hurts to be safe.
I did the check prior to make sure there was an xtarget at which point you shouldn't get a nil.
 
He's giving a default value of 0 in case of a nil value.

Pretty sure pctAggro returns a number always but it never hurts to be safe.
I did the check prior to make sure there was an xtarget at which point you shouldn't get a nil.
Did you test it when that xtarget is no longer there?

Start Loop 5 Xtargets
By loop 4 Xtarget 1 is dead, 5 moves to 4, 5 is nil etc.
I've hit a ton of these with rgmercs.
 
i never get a nil return its typically at 100 or last value when no target on xtarg for that slot.
If you check that mq.TLO.Me.XTarget(i).ID > 0 we don't care if there is nothing in that XTarget slot and skip over it.
looking back i did forget this check in the post above though.

making that my primary check I haven't had a nil PctAggro.

again though it never hurts to play it safe with a default value safety net.

and this is what i see with Lua evaulator.

1712803364556.png
 
Code:
local function CheckAggro()
   for i = 1, mq.TLO.Me.XTarget() do
      if mq.TLO.Me.XTarget(i).PctAggro() > 90 then
         return true
      end
   end
   return false
end

The problem that I am having is that, many times, neither mq.TLO.Me.XTarget() nor mq.TLO.Me.XTarget(1).PctAggro() reset back to zero when all the mobs in the Xtarget list have been killed off.

See screenshots below.

Firstly, I just zoned in and my aggro list was empty, and both mq.TLO.Me.XTarget() and mq.TLO.Me.XTarget(1).PctAggro() were at 0:

Screenshot 2024-04-11 100721.png

Then, I pulled a mob and mq.TLO.Me.XTarget() updated to 1 and mq.TLO.Me.XTarget(1).PctAggro() updated to 100:

Screenshot 2024-04-11 100734.png

Finally, my pet killed the mob off yet mq.TLO.Me.XTarget() did not go back to 0 and mq.TLO.Me.XTarget(1).PctAggro() did not reset, even though the Xtarget list was indeed empty once again:

Screenshot 2024-04-11 100854.png

Is this a bug? Why dont they reset to their original state?
 
Sorry about that I forgot the check if
mq.TLO.Me.XTarget(i).ID() > 0 check

I added it in to the prior code.
That will update properly

This double-check made the trick!

While mq.TLO.Me.XTarget() still shows (incorrectly) that there are mobs in the XTarget list (even though all of them have been killed off), your mq.TLO.Me.XTarget(i).ID() > 0 double check returns that the inexistent mob's ID is obviously 0, thus preventing the IF from executing the commands within. Brilliant :)
 
and for added protection. as Derple said you can do something like this.


Code:
        for i = 1, mq.TLO.Me.XTargetSlots() do
            local xID = mq.TLO.Me.XTarget(i).ID() or 0 -- safety net incase of a nil make it 0
            if  xID > 0 then
 
Question - How does the AGGRO meter works?

Users who are viewing this thread

Back
Top
Cart