#Set Instance Color acting... wrong?

9 messages · Page 1 of 1 (latest)

desert narwhal
#

ive set up a "timer" that every step decrements by one, im using it for a number of things inside of this object, and i wanted it to "flash" colors based on the timer, and so i set up several Expression Ifs checking to see when the timer is between certain values, what is very strange is that the object is red the moment it spawns, and only changes back to normal once the timer is past -105 (which makes it "white" again), most of the time when i encounter an error i can at least imagine how the code led to it, but in this case i just cant wrap my head around why it could be doing this at all

rain scarab
#

You’re trying to put multiple > comparisons into a single clause

#

this is invalid syntax. use one > per clause and join em with && operators

#

for example 5>TrackingTime>-5 would first evaluate 5>TrackingTime, then if that is true or false it’ll evaluate true/false > -5

#

and you can see that expression will always, undeniably be true in all situations, because it’s either true > -5 (the same as 1 > -5) or false > -5 (the same as 0 > -5). regardless of which it does both are true

#

so 5>TrackingTime>-5 is functionally identical to just writing true - not really a desirable outcome!

#

instead, consider TrackingTime < 5 && TrackingTime > -5

desert narwhal
#

ahhhhh thank you so much! my fault for not checking the documentation 😅

#

that is working exactly how i want it now! 👍