WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   [LUA] Questions about events and the execution order (https://www.wowinterface.com/forums/showthread.php?t=54901)

millanzarreta 12-08-16 08:07 AM

[LUA] Questions about events and the execution order
 
Hi.

First, sorry for my bad English. I am creating an addon that needs check the buffs/debuffs of the some units when they are casted. I have 4 questions.

I am using COMBAT_LOG_EVENT_UNFILTERED and checking the type of events SPELL_AURA_APPLIED, SPELL_AURA_REFRESH for check when the buff/debuff applieds, but the duration it's not included in this event. For check the durations, I think I can't use UnitAura() function on COMBAT_LOG_EVENT_UNFILTERED, because this it's insecure, I think UnitAura() function it's only guaranted to provide correct results after UNIT_AURA event. I use the event UNIT_AURA, but some drawbacks occurs:
  • UNIT_AURA only triggers for valid units (player, pet, target, focus, partyX, raidX arenaX, nameplateX, ...), while COMBAT_LOG_EVENT_UNFILTERED triggers for any unit loaded by the client (100yd aprox). This it's a minor issue, I think I can ignore these units...
  • UNIT_AURA only have 1 arg, the unitId, I need do a loop for all auras using UnitAura(unit, i) (maybe a bit cpu expensive do this in all UNIT_AURA events?)
  • I think UNIT_AURA it's executed after the COMBAT_LOG_EVENT_UNFILTERED events, but i don't know if this it's always the case, and it's hard maintain the consistency if I don't know the exact order of the execution... I don't know if when I executed the UNIT_AURA event I have the security that my COMBAT_LOG_EVENT_UNFILTERED function it's totally executed.

For the events, I am using a Frame and RegisterEvent function.

Now, the questions:
  • 1º question: Is it right that I can't use UnitAura() in COMBAT_LOG_EVENT_UNFILTERED and I should wait to UNIT_AURA event to use UnitAura() function securely?
  • 2º question: UNIT_AURA event it's always triggered after COMBAT_LOG_EVENT_UNFILTERED? it's guaranted the order?
  • 3º question: If the 2º question answer it's "yes": UNIT_AURA event it's executed in my script after the execution of the COMBAT_LOG_EVENT_UNFILTERED finished? or these two events executes in my script asynchronously?
  • 4º question: any other simple way to do this better?

Thanks for the help! :)

SDPhantom 12-08-16 06:12 PM

Secure and insecure are terms for the taint system and could cause some confusion if used in this example. Another side note, UnitAura() can only query units with a valid UnitID, so the limitation of UNIT_AURA is the same as what you can examine with UnitAura().
  1. Using data functions outside of their respective events is not recommended because of the random nature of when events fire. Doing so produces inherent instabilities in your code that may or may not show up in your own testing.
  2. Events that aren't grouped in a series can fire at any time in any random order. Any observed firing order shouldn't be trusted as it's not guaranteed to stay the same whether it be between different users, builds, or even sessions.
  3. WoW runs the entire UI on a single thread, meaning only one section of code can be run at a time. There are times when it seems to bend this rule when you run functions that result in immediately firing an event, the game deals with that event before returning to your code.

millanzarreta 12-09-16 03:05 PM

Thanks for the info. It's all I needed know :) :) :)


All times are GMT -6. The time now is 12:49 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI