[messages] [Module Design] Dynamic Property Set Value: Why this formula does'nt works?

Parduz pardpubb at infinito.it
Sat Oct 5 02:15:56 CEST 2019


I'm building a "Door" Prototype. Inside there's a dynamic property
called "__DoorStatus__", which represent the ... well... door status  :D


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:

Code:
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:


Code:
{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__ 1 __(why?)
if __DoorStatus __is 2, it becomes __1 __(why?)

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?

_______________________________________________
Read this topic online here:
http://www.vassalengine.org/forum/viewtopic.php?p=57729#p57729


More information about the messages mailing list