WeakAuras

WeakAuras

206M Downloads

Code block that is run on trigger update

asakawa-k opened this issue · 10 comments

commented

Is your feature request related to a problem? Please describe.

I want to be able to run some code whenever any trigger's state changes.

Describe the solution you'd like

I'd like to see Actions - On Trigger Update, a function that gets sent the trigger (and clone?) whose state has changed.

If the consistency of Actions code blocks not running functions were imported then perhaps simply aura_env.lastTriggerUpdate could be provided.

Describe alternatives you've considered

"Trigger Update" on Custom Text only runs when the "current" trigger changes and, honestly, Custom Text gets abused enough - perhaps some more options for running custom code at useful times could draw people away from lazily running every frame code so much.

Additional context

A specific use case might be having trigger2 checking for buffs on the raid and creating clone states. I want to make trigger1 to check those states, make decisions based on them and output my own info based on them. Currently I need to run my own custom trigger on every frame to catch changes to the clones.
I think it would see a lot (relative) of use with the amount of anchoring that's done these days too.

(tbh, I'd welcome an "Every Frame" code block there too so that, when Every Frame code really is appropriate, we don't need to muddy things by using Animations or Custom Text.)

commented

This is now possible via a watching custom trigger.

commented

An additional benefit to this would be providing a way to run custom code on an Aura like a Texture that has no Custom Text to piggy-back on to.

commented

what about a trigger update event :peepoStudy:

commented

That would be fine for all my own use cases, as I would probably be running ScanEvents in the clode block itself, but it would effectively hide it form users entirely.

commented

A...trigger update event? As in, a fake event called “TRIGGER_EVENT” which you could subscribe to? That doesn’t sound very practical (not to mention the performance cost for heavy users...)

commented

With my branch, "Trigger Update" on Custom Text runs whenever a trigger updates, not just for the currently active trigger. Same with having texts on Textures, those are coming. I haven't touched that branch in while, but it's almost done, just need to finish a few things.

I don't see how having a Action/On Trigger Update would help your use case though, since it would be essentially circular?

On T2 updating => Action/On Trigger Update runs, which somehow modifies T1, which then runs Action/On Trigger Update ?

There's also already a ticket for that open.

As to anchoring, it's pretty clear that we need something for nameplate anchoring though I have no bright idea how to do that. Maybe we juast add a "custom anchoring" function to the anchor options? Anyway, it's about time someone creates a ticket for that.

So I'm not too sold on this, although if someone comes with a patch for that.

commented

I actually made something just today that would really love to have a better way to trigger.
https://wago.io/GlowOnDemand++

I'm basically comparing 2 group-unit triggers to evaluate multiple buffs on each unit. The workaround I had to use was to track UNIT_AURA and add a delay to allow for the default aura triggers to set their states.
My feeling is that Auras like this will become more widely used over time. The updated custom text method will help but still feels like "abusing" something that happens to work.

commented

But while having a Action On Trigger Update helps with that, it would still be a kludge, since you aren't supposed to change trigger's states from there. That would be better suited by a kind of proxy trigger.

commented

We could add a global condition to achieve this.

commented

If the Global Condition thing goes ahead, would also suggest a per-trigger Condition too for that trigger updating.