WeakAuras

WeakAuras

206M Downloads

Would like a method for preventing re-triggering of a trigger if it is already active

jagaudet opened this issue ยท 5 comments

commented

I implemented a Progress Bar with a custom trigger and duration, but the trigger criteria is such that it will re-trigger constantly. This, in turn, causes the time to "jitter" slightly as the custom duration is re-calculated. It's accurate, but, instead of ticking down smoothly once per second, it appears to jump around a little.

I had previously solved this by including:
WeakAuras.IsTriggerActive("Aura Name") in the custom Trigger, but that function went away. There appear to be other non-helper functions or objects that may work for this, but I'd rather use something supported that will, if changed, be included in deprecation or release notes.

A helper function to replace WeakAuras.IsTriggerActive() would be great for this case, though conceivably the concept may be useful for non-custom triggers, which suggests a checkbox in the UI instead. I just can't think of a case offhand, since most "triggers" appear to be single events; this one seems somewhat special, as it needs to trigger, if not already triggered, at any time within a 2-3 hour window based on time, and re-trigger upon login, etc.

For reference, it's a two-aura group that shows two timers, one showing the duration until the next Battle for Nazjatar window opens, and one that, when within the window, shows the max time for the battle to start. The custom trigger for the "next window" one is, as an example:

    local windows={0,3,6,9,12,15,18,21,24}
    local h = tonumber(date("!%H"))
    if WeakAuras.IsTriggerActive("Battle for Nazjatar Window in") then
        return false
    elseif WA_GetUnitDebuff("player","Battle for Nazjatar Participant") then
        return true
    elseif tContains(windows,h) or WA_GetUnitDebuff("player","Do Your Part!") or WA_GetUnitDebuff("player","Eligible for Rewards") then
        return false
    else
        return true
    end
end
commented

That's easily doable with a TSU trigger, you get the existing states in that trigger.

commented

you can also use WeakAuras.GetActiveTriggers(aura_env.id)[1] where 1 represents the trigger number

commented

Thanks. I'll try "WeakAuras.GetActiveTriggers(aura_env.id)[1]". A TSU seems pretty complicated for this case.

commented

That worked as a drop-in replacement for the code I had. Still, that could change at any time; I'd reconsider this request, it seems like a simple case that doesn't really warrant the complexity of TSU trigger.

commented

TSU isn't that complex, and it solves your problem.