Example:
Let's say I would like to listen to the ENCOUNTER_START event, and when the encounter starts I would like to do some custom code after 5 seconds. There are many ways to do this, but I'll make an example that uses both WeakAuras.ScanEvents and the build in C_Timer. The following snippet would capture the ENCOUNTER_START event and queue up a function that will be invoked 5 seconds later. That function will broadcast my own event "DO_MY_THING_EVENT". The same function would listen to this event as well and when it happens it will react to it.
To set up the trigger you would have to select:
- Type == Custom
- Event Type == Event
- Event(s) == ENCOUNTER_START; DO_MY_THING_EVENT
The custom trigger would then look like this:
Code:
function(event, ...)
local encounterId = ...
if event == "ENCOUNTER_START" and encounterId == 1799 then
C_Timer.After(5, function()
WeakAuras.ScanEvents("DO_MY_THING_EVENT")
end)
end
if event == "DO_MY_THING_EVENT" then
-- do whatever you want todo
end
end
Know that I could have also just did the code I wanted todo right into the function of C_Timer.After. The benefit of using WeakAuras.ScanEvents is that a completely different WeakAura or trigger can pick up on your own events and react accordingly.
I hope this example helps.