I’m building a “Door” Prototype. Inside there’s a dynamic property called “DoorStatus”, which represent the … well… door status
0 means the door is closed
1 means the door is open
2 means the door is destroyed.
So my DoorStatus dynamic property is configured this way:
Name: DoorStatus
Value: 0
Is Numeric: CHECK
Min: 0
Max: 2
Wrap: UNCHECK
I want to switch from 0 to 1 and viceversa with the same key command, but do nothing if the door is destroyed.
So i’ve made a Open / Close command that set value directly with this expression in the New value field:
{If(DoorStatus==0,1,If(DoorStatus==1,0,DoorStatus))}
To me, this line means that
if DoorStatus is 0, it returns 1
else if DoorStatus is 1, it returns 0
else it returns the current value of DoorStatus (so, not changing it).
But this does’nt works; when i give the key command:
if DoorStatus is 0, it becomes 1 (and this is ok)
if DoorStatus is 1, it remains[b] 1 /b
if DoorStatus is 2, it becomes [b]1 /b
The same expression put in a calculated property (NextDoorStatus) works as expected.
Why i don’t get the expected results and instead it always returns 1?