#Using custom function within Conditions

7 messages · Page 1 of 1 (latest)

visual yacht
#

Hi,
Is it possible to use custom function activation within conditions?

Idea is simple; just want to play a sound when my arrangement of triggers are satisfied. I don't find any resources what custom check is, or how it is used.

If your interested in how I go about this:


function(trigger)
    mhWindfury = trigger[1]
    ohWindfury = trigger[2]
    mhFlametongue9 = trigger[3]
    ohFlametongue10 = trigger[4]
    
    if mhWindfury and ohWindfury then
        return true
    end
    
    if mhWindfury and mhFlametongue10 then
        return true
    end
    
    if mhFlametongue9 and ohFlametongue10 then
        return true
    end
    
    return false
end
white compass
#

This can be done with basic Any Of, All of, and trigger isActive conditions. No code required

leaden ibex
#

especially no globals

white compass
#

Yep. If you don't put local in front of a variable declaration it is created/written in the global scope

#

But that's besides the point here either way, just useful to know

visual yacht
#

I'll keep that in mind, thanks about local-headsup. I guess the low-code answer is warranted albeit not very fun from a programming standpoint. Cheers!

white compass
#

When doing more interesting stuff from a code perspective, I'd say it's more fun to use TSUs and custom variables 😛