#Custom Function for Triggers

17 messages · Page 1 of 1 (latest)

severe smelt
#

Currently my custom trigger says:

function(t)
return t[1] and not t[2] or t[1] and not t[3] or t[1] and not t[4]
end

Turns out I don't know nothing about the rules of coding. What I want to happen is:
Check if t[1] and not t[2] is true OR if t[1] and not t[3] is true OR if t[1] and not t[4] is true. That's obviously not what's happening.. Thankful for any input. Hypers

pseudo current
#

why check for t[1] and not t[2] twice

severe smelt
#

typo

pseudo current
#
function(t)
    return t[1] and (not t[2] or not t[3] or not t[4])
end```
severe smelt
#

doesnt seem to work. what does work however is:

function(t)
return t[1] and (not t[2])
end

but obviously only for t2.

pseudo current
#

then your triggers are wrong

#

because your example had to work too

severe smelt
pseudo current
#

check your 2nd trigger then

severe smelt
#

nope. each trigger is working individually. just not as soon as a add them up. feels extremely weird. tripple checked.

#

function(t)
return t[1] and (not t[2])
end

working.

function(t)
return t[1] and (not t[3])
end

working.

function(t)
return t[1] and (not t[2] or not t[3])
end

not working.

pseudo current
#

add prints then before return print(t[1], t[2], t[3], t[4])

severe smelt
#

I think it seems to make sense, is says:

true false false (if only t1 is active neither t2 or t3)
true true false (if its only t1 and t2) and
true false true (if its t1 and t3)

despite of that. it just doesnt work. ^_^ once again, using only return t[1] and (not t[2]) is working flawlessly.

pseudo current
#

custom activation logic is correct all i can say

severe smelt
#

I got it!! Jesus...

function(t)
return (t[1] and not t[2]) or (t[1] and not t[3])
end

#

sheer luck though.

#

thanks for you help. brackets. you gifted me brackets. ❤️