posted 24-02-2003 07:57 GMT
mortimer jazz wrote:
quote:
My TV has the property "isOn" with an initial value of "false". How can I check or change this? I can't get it to work in the same way as vars. When the player examines the TV I want to run different scripts (and switch the property value)depending on the stutus of this property. I can't see how to do this in the help section.
By supplying a value of the typed word 'false' - which I assume is what you mean by the above, you are actually creating a string property and storing the word "false" in it, not creating a Boolean property that is either true or false - which I think is what you actually want to do here (The TV is either on or off - no other possibilities).
To create a property of this type, you do NOT supply a value argument. The logic is that the object then either has the property 'IsOn' - or it doesn't.
You'd check this with something like:
quote:
if property <TV;IsOn> then {
msg <The TV is showing a naff game show.>
}
else msg <The TV is off.>
You could test for it NOT having IsOn like so:
quote:
if not property <TV;IsOn> then {
msg <The TV is off.>
}
else msg <The TV is showing a Baseball match.>
So either way is possible.
You change the TV's 'IsON' status with a properties statement like so.
quote:
properties <TV; Ison> 'makes IsOn = true
or
properties <TV; not IsOn> 'makes IsOn = false
Hope this helps!
This is the sort of thing I hope to explain in my forthcoming Quest ASL tutorial, although it will concentrate on coding by hand rather than through QDK, the logic of this kind of thing is exactly the same whichever way you create it.
Al