Hi, I have made a code that makes a counter, but it is required that the counter is executed only after C_Timer.After is finished. As far as I understand C_Timer.After is executed asynchronously, so return true happens immediately when the subevent is executed. How can this problem be solved?
function(allstates, e, ...)
if e == "COMBAT_LOG_EVENT_UNFILTERED" then
local timestamp, subevent, hideCaster, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags, spellID = ...
if sourceGUID == aura_env.myGUID then
if (subevent == "SPELL_CAST_SUCCESS" and spellID == 1943) then
C_Timer.After(1, function()
aura_env.chance = aura_env.chance + 1
allstates[""] = {
show = true,
changed = true,
autoHide = true,
stacks = aura_env.chance,
}
end)
return true
elseif ((subevent == "SPELL_AURA_APPLIED" or subevent == "SPELL_AURA_REFRESH") and spellID == 424493) then
aura_env.chance = 0
allstates[""] = {
show = true,
changed = true,
autoHide = true,
stacks = aura_env.chance,
}
return true
end
end
end
end