#How to tell when a watched(watching?) trigger becomes inactive?

5 messages · Page 1 of 1 (latest)

latent grove
#

I have a watched trigger that fires when other triggers are active; it also checks when those other triggers become inactive, but I'm not sure how to actually check for that in code, as when the triggers are inactive, the updatedTriggerStates param doesn't have useful information (and I'm having trouble checking if its nil or similar).

Backstory - I have multiple simple triggers for buffs, bloodlust, combat potion, lightweave proc, engi gloves activated, etc.
I want to display how many are active at any given time. 0 if none are, 1 if just bloodlust, 2 if bloodlust + engi gloves...etc

function(event, triggerNum, triggerStates)
    if event == "TRIGGER" and triggerNum then        
        DevTool:AddData(event, "event")
        DevTool:AddData(triggerStates, "triggerStates")
        DevTool:AddData(triggerNum, "triggerNum")
        
        if next(triggerStates) == nil then                                 -not consistently working
            aura_env.score = aura_env.score - 10
        end

        for _, state in pairs(triggerStates) do  
            if state.show then
                aura_env.score = aura_env.score + 10
            end
           
        end
        
        return true

my devtool just shows the triggerStates table as not having anything in it (when the function is checked upon losing one of the buffs)

latent grove
#

I'm also noticing a real oddity -

If I gain buff A, then gain buff B, then lose Buff B, then lose buff A, everything works as expected and what not. I can see the events happen as expected (buff A has trigger id 7, buff B has trigger id 1)

if I instead:
Gain buff A
Gain buff B
Lose buff A <-- weirdness happens
Lose buff B

then when i lose buff A, my "score" counter doesn't decrement 10 as i would expect (despite the table seemingly being empty), and buff B also gets checked (it still is active, so nothing seems to change w/ it)

#

pic 2, of the weird scenario

regal bluff
#

@latent grove use CopyTable(triggerStates) inside your dump.
Without it your dumplogs might not be correct, as the tables can be modified even after they are logged (it keeps the reference).

latent grove