1. #1
    Deleted

    What is the most lightweight event frequency to use in a raid?

    I need an event that happens rarely enough but frequently enough to be used in a raid. (the application is a trigger on an auras addon)

    I currently use UNIT_STATS and PLAYER_ENTERING_WORLD but I'm worried that UNIT_STATS is updated too frequently. Is there something better inflicting less load?

    The use is: querying stats on a char.

  2. #2
    Deleted
    Why don't you simply use a timed OnUpdate? Unless I'm not quite understanding what you want.

  3. #3
    Deleted
    It's for use on an addon, I can't make global loops.

  4. #4
    Scarab Lord
    15+ Year Old Account
    Join Date
    Aug 2008
    Location
    Texas
    Posts
    4,040
    Your addon can totally use a locally timed OnUpdate... how many seconds do you want between updates?

    The below code creates a frame that does stuff every 5 seconds. The "elapsed" thing only updates on full seconds, afaik, so it can't be used for, say, 2.5 second updates... but oh well, in that case, 2 or 3 should work fine.
    Code:
    local a = CreateFrame("Frame", nil, "UIParent")
    local timer = 0
    
    a:SetScript("OnUpdate", function(self, elapsed)
      if (timer >= 5) then                    -- Check every 5 second (approx)
        -- stuff you want goes here
        timer = 0
      else
        timer = timer + elapsed
      end
    end)

  5. #5
    Deleted
    arg2 of OnUpdate passes the exact fractional time passed in seconds. You can specify any delay.

  6. #6
    You could also use an animation timer (I like those ).

    But really, if you want to query stats on a char, use UNIT_STATS, it doesn't fire _that_ often, and it's just the right event for that. You'd want your addon to update if stats change, right? So use this event.

  7. #7
    Deleted
    It's not my addon, it's weakauras.

    edit: ^ ye, it doesn't fire that often, but .. it may fire often. I mean, almost half the effects in this game affect stats.

    edit: I had thought of the 'changed target' event but then again that might fire too scarcely.

    edit: It's probably best to use stats in the end though since I try to query stats in this instance.
    Last edited by mmoc5a44133bd1; 2011-12-13 at 10:03 AM.

  8. #8
    Weelll, it only fires if the primary stats change, right? Buffs and such are applied at the beginning of the fight, so there isn't really a lot going on, except for death+rebuff, trinket procs... can't really think of a lot else. What exactly are you trying to accomplish, maybe someone has a good idea?

  9. #9
    Deleted
    Well, yeah, there are the various procs of enchants, procs of 2-3 abilities in each class//spec, there may be some raid-wide bufs because of other classes or the encounter, yeah, it's not that much but I was wondering if I can avoid it with fewer.

    It's probably though a good solution since I'm trying to track stats anyway.

  10. #10
    What you could do is put the following into a macro, execute it ingame and see for yourself how often UNIT_STATS triggers (drycoded!):

    /run local f = MyUS or CreateFrame("Frame","MyUS"); f:RegisterEvent("UNIT_STATS"); f:SetScript("OnEvent",function(self,event,unit) print("UNIT_STATS") end)

  11. #11
    Deleted
    It appears to be every 1-2 seconds. [or more, depending on class/other conditions]

    By the way it appears to only affect 'base' stats, not even stats like crit rating.
    Last edited by mmoc5a44133bd1; 2011-12-13 at 10:42 AM.

  12. #12
    Quote Originally Posted by FemaleGoblinMage View Post
    It appears to be every 1-2 seconds. [or more, depending on class/other conditions]
    And raid size, of course But 1-2s is really not a lot, and since you want to catch the changes of your stats...

    By the way it appears to only affect 'base' stats, not even stats like crit rating.
    That's what I meant by "primary stats". I have not found an event for the change of secondaries, so one would probably need a throttled ON_UPDATE or an animation timer for such a thing.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •