Inform 7 Home Page / Documentation
§3.6. Either/or properties
Some containers, like bottles, can be opened: others, like buckets, cannot. If they can be opened, then sometimes they will be open, and sometimes closed. These are examples of properties, which can change during play. The following source sets some properties:
The cardboard box is a closed container. The glass bottle is a transparent open container. The box is fixed in place and openable.
There are only four different properties referred to here. Closed means not open, and vice versa, so these two adjectives both refer to the same property. (As might be expected, when a container is open, one can see inside and place things within, or take them out.) The glass bottle and the box being containers is a matter of their kinds, which is something fundamental and immutable, so "container" does not count as a property.
A "transparent" container is one which we can see inside even when it is closed, and the opposite is an "opaque" container.
The property of being "fixed in place" ensures that the player cannot pick the item up and walk away with it: this is useful for such things as oak trees or heavy furniture. The opposite condition is to be "portable".
A container which is "openable" can be opened or closed by the player; as might be expected, the opposite is "unopenable".
With a really large cardboard box, we might imagine that the player could get inside: such a container should be declared "enterable".
Within a room, we might have containers and supporters that a player can enter. A chair, stool, table, dais, or pedestal would be an enterable supporter (anything we would describe a person as being "on"); a cage, hammock, or booth would be an enterable container (because we would describe the person as being "inside").
When the player is in or on something, he is able to see the rest of the contents of the room, but a note such as "(in the hammock)" or "(on the poster bed)" is added to the room title when he looks around.
Here is an example to show off the possibilities:
Notice that we made the cage transparent. Strictly speaking it is not made of transparent materials, but we can see into (or out of) a closed cage due to the gaps between the bars, so that from Inform's point of view a cage behaves much like a large sturdy glass box. (If we really wanted to make a distinction between, say, an airtight container and one with perforations, we could do so, but Inform does not model such nuances by default.) If a container is not transparent, we can see into and out of it only when it is open.
Supporters are a bit more straightforward because there is no circumstance in which they separate the player from the rest of the world:
And in fact we can tell Inform that the player starts on the pedestal with this line:
Now the player will begin there rather than just in the Center Ring.
This last bit is an entirely unnecessary bit of local color, but if we're going to keep getting into and out of the lion's cage, we ought to expect him to take notice:
Every turn when the player is in the cage:
if a random chance of 1 in 2 succeeds, say "The lion eyes you with obvious discontent.";
otherwise say "Though the lion does not move, you are aware that it is watching you closely."
Randomness is explained more completely in the chapter on Change, and every turn rules in the chapter on Time.
Finally, we might want a container whose interior is modeled as its own separate room: say, a magician's booth in which volunteers are made to disappear.
The magician's booth is a container in Center Ring. "Off to one side is a magician's booth, used in disappearing acts. The exterior is covered with painted gilt stars." The booth is enterable, open, not openable, and fixed in place.
Now we create our other location:
...which handles the case of the player typing >IN. (We will not assume by default that he wants to get into the cage with the lion, this being obviously perilous.) But we also want to make sure that the player who types >ENTER BOOTH winds up in the same place, so we should add: