Thread Tools Display Modes
12-08-16, 08:07 AM   #1
millanzarreta
A Deviate Faerie Dragon
 
millanzarreta's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2010
Posts: 11
[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!

Last edited by millanzarreta : 12-08-16 at 08:09 AM.
  Reply With Quote
12-08-16, 06:12 PM   #2
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,327
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.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 12-08-16 at 06:16 PM.
  Reply With Quote
12-09-16, 03:05 PM   #3
millanzarreta
A Deviate Faerie Dragon
 
millanzarreta's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2010
Posts: 11
Thanks for the info. It's all I needed know
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » [LUA] Questions about events and the execution order


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off