Inform 7 Home Page / Documentation
§8.4. Change of either/or properties
When we have an either/or property, we can set it like so:
Instead of waiting when the oaken door is closed:
say "There is a slow, creaky click! sort of noise as the door swings open, apparently all by itself.";
now the oaken door is open.
If it is open already, nothing changes: in any case nothing is said to the player unless we give explicit instructions to that effect, as we've done here.
Inform protects its model world from accidental damage in several ways, one of which is to ensure that things are not given properties which they are not allowed to have. So this, for instance, will not be accepted:
now the oaken door is unvisited
More subtle problems arise if it is not possible to tell, when the story is being constructed, what the object in question will be: for instance, if we try to change a randomly chosen object to be "unvisited". Inform therefore makes additional checks during play, printing up a suitable message only if the rules are violated. The net effect is that it is impossible for the oaken door ever to have the "unvisited" property.
|
ExampleVitrine
An electrochromic window that becomes transparent or opaque depending on whether it is currently turned on.
|
|
"Vitrine"
Plaza View is a room. "Your uncle's apartment, on loan to you for viewing the parade and celebrations today. This would be more of a sacrifice on his part if he weren't currently yachting around Corfu."
The smart window is a device in Plaza View. It is fixed in place. "A vast smart window [if transparent]overlooks the park[otherwise]has turned to a sheet of hazy blue[end if]." The smart window can be transparent. The smart window is transparent. The description is "An electrochromic device which changes shade and transparency in response to the application of current.
Curtains are so last year."
Note the "can be transparent" line. Devices ordinarily are not allowed to have transparency or opaqueness, but we can make an exception in this case. Without that line, attempts to change the transparency of the window will fail.
Carry out switching off the window: now the window is transparent.
Carry out switching on the window: now the window is opaque.
Instead of searching a transparent window: say "Isn't it lovely out there?"
Instead of searching an opaque window: say "The window is currently darkened."
Test me with "look through window / switch window / look through window / look".