1. #1
    The Lightbringer Lovestar's Avatar
    10+ Year Old Account
    Join Date
    Nov 2010
    Location
    United States
    Posts
    3,075

    WeakAuras custom triggers, without using Every Frame

    I use WeakAuras currently to take care of stuff that other addons don't have a premade way of doing, because I can create Custom triggers and just slap in any LUA code I can figure out. This is generally faster than trying to hunt down an addon that does what I need.

    WeakAuras gives you 2 choices for how it can check your trigger:
    • Every time an EVENT(s) fires
    • Every frame

    I'm worried that using "Every frame" is a Really Bad Idea™ because (warning: programming-ignorant) it just sounds really inefficient and like it will be more prone to causing conflicts/problems.

    But there are three things I currently want to check which I can't figure out how to do without using "Every frame":
    • IsSpellInRange, for my pet's Shadow Bite/etc.
    • CheckInteractDistance, for Shadowflame (don't laugh, it works to ~90% accuracy using Trade range :p)
    • GetUnitSpeed, to know if I'm moving and thus suggest a priority of available instant spells

    Like, checking my Mana status, or when I switch targets, was really easy — UNIT_POWER & PLAYER_TARGET_CHANGED. But these ones are really weird, I can't find anything that relates to a spell going out of range, or unit distances changing, or a unit starting/stopping movement. But the game has to know when those things happen, so why can't I find events for them?

    Last time I asked this, someone suggested using Secure Function hooks to do it, but while that was an interesting diversion it just confused me and I couldn't figure out how to use it to solve the problem.

    So is this possible, or do I have to use "Every Frame" if I want to use WeakAuras to check it? Any insight/clarification is, as always, appreciated. :>

  2. #2
    or unit distances changing, or a unit starting/stopping movement
    I don't think there is anything for these. You can't know exact distance to an enemy unit. At best people estimate it to a few yards but only to units with an id like a target, focus, mouseover and so on and what you listed is pretty much what you use. Spell range, item use range and interact distance.
    For friendly units that are grouped with you, most mods use map coordinates to deduce distances as far as I know.

  3. #3
    The Lightbringer Lovestar's Avatar
    10+ Year Old Account
    Join Date
    Nov 2010
    Location
    United States
    Posts
    3,075
    I know, but I'm not asking how to check this stuff, I know what API queries I want to use already.

    I'm asking how to know when to check this stuff — if the game gives you some clue that something has changed, then you can register a frame and have it capture that EVENT, so you're not wasting resources checking the same variable over and over every single frame (as in FPS frames).

    For example, if I want to set WeakAuras to show a spinning zebra riding a mushroom when my Mana reaches 50%, I can tell it the EVENT is "UNIT_POWER" and then it will just quietly do nothing until WoW fires the "UNIT_POWER" event indicating my Mana amount changed. Then it checks the variable.

    That's a lot more efficient than blindly calculating current Mana / max Mana every single frame (which will include lots of time when I'm not spending any and thus, there's absolutely no need to bother checking the variable).

    But I can't figure out how to be clean like that with the stuff I'm asking about here, which is why I'm hoping someone with more experience doing AddOn stuff can suggest something I'm missing.

  4. #4
    Ahh I see what you mean.
    Yeah sorry can't help you with that

  5. #5
    Deleted
    While I don't know which events fire off the top of my head, using /eventtrace should provide answers fairly quickly.

  6. #6
    The Lightbringer Lovestar's Avatar
    10+ Year Old Account
    Join Date
    Nov 2010
    Location
    United States
    Posts
    3,075
    Wow, that's cool. Thanks. :>

    So if I do something (eg, putting my pet in range of the target for Shadow Bite) and the Event Trace window just sits there smiling at me without updating, does that mean there's no way to track the status of that condition without checking "Every Frame" ?

Posting Permissions

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