How do I create a piston that adds +1 to a numeric variable?


#1

Hi everyone!
I’m trying to make a piston that every time it runs, it adds 1 to a numeric variable, and every time the variable reaches 4, it sends a notification and resets the count to 0.
I have experience with boolean variables but not with numeric ones and don’t know how to make it do the math, so any help is appreciated!

Thanks,
Rodrigo


#2

Just use set variable to ‘variable+1’ as an expression. If you have something tomtrigger the piston, the logic should be simple

Variable = variable+1
If variable is equal to 4
Then
Push notification
Variable=0
Endif