| Chapter 3: Things |

| 3.12. Doors

The map of an interactive fiction is the layout of rooms and the entrances and exits which connect them. So far, these map connections have always run from one room to another, like so:

> The Painted Room is north of the Undertomb.

However, we can also interpose doors between rooms, like so:

> The heavy iron grating is east of the Orchard and west of the Undertomb. The grating is a door.

The second sentence is needed since otherwise Inform will take "heavy iron grating" to be the name of a third room, whereas what we want is for the grating to be something physically present in both the Orchard and in the Undertomb, and acting as a conduit between them. To this end it needs to be a "door", a kind we have not so far seen. In the absence of any other instruction, a newly created door will be fixed in place, closed and openable.

The grating really does come in between the two rooms: the grating is what lies immediately east of the Orchard, not the Undertomb room. So if we wrote the following:

> The Undertomb is east of the Orchard. The heavy iron grating is east of the Orchard and west of the Undertomb. The grating is a door.

then Inform would say that this is a contradiction: we said the Undertomb was east of the Orchard, but then we said that the grating was east of the Orchard.

Inform's "door" kind can be used for all manner of conduits, so the word door need not be taken literally. In Ursula K. LeGuin's beguiling novel "The Tombs of Atuan", from which the above rooms are stolen, it is not a grating which interposes, but:

> The red rock stair is east of the Orchard and above the Undertomb. The stair is an open door. The stair is not openable.

In real life, most doors are two-sided, and can be used from either of the rooms which they join, but this is not always convenient for interactive fiction. Here is a one-sided door:

> The blue door is a door. It is south of Notting Hill. Through it is the Flat Landing.

(Note the use of "it" here as an optional abbreviation.) This will make a door visible only on the Notting Hill side; no map connection will be made in the reverse direction, unless we ask for one.

Should we ever need it, the values "front side of ..." and "back side of ..." reveal where a door is placed. (For instance, "front side of the heavy iron grating" is the Orchard.)

17
| Example Disappointment Bay 5 Disappointment Bay: adding the door and the deck to our charter boat.

18
| Example Escape Window that can be climbed through or looked through.

Suppose we want to offer the player a window he can climb through, instead of a boring ordinary door. Our window will be like a door in that it connects two rooms, appears in both places, and impedes movement when it is shut. But we also want to add that we can look through it and see what lies on the other side; and we further want to understand "climb through window" or "jump through window" as attempts to pass through it. We'll start by defining a couple of rooms and making the window a door between them. "Escape" Your Bedroom is a room. The bedroom window is a door. It is west of Your Bedroom and east of the Grassy Slope. Now we have a "bedroom window" object which can be entered. Now, to catch the case where the player types "LOOK THROUGH WINDOW": Instead of searching the window: say "Through the window, you make out [the other side of the window]." The other side of a door is always defined to be the room that we are not currently in when doing the check. When we are in the bedrooom, the other side will be the grassy slope, and vice versa. "Searching" is the action that occurs when the player attempts to LOOK THROUGH something. (To review what grammar gives rise to what actions, we can always consult the Actions portion of the Index.) Next we want to cover the case where we climb through the window: Instead of climbing the window: try entering the window. And because "climb window" is understood but "climb THROUGH window" is not, we will have to borrow from the chapter on Understanding to add some new vocabulary to the game (and we'll add Jump too, while we're at it): Understand "climb through [something]" as climbing. Understand "jump through [something]" as climbing. Now the final piece: Inform will already keep the player from going through a closed window, but it will say "You can't, since the bedroom window is in the way." This is probably not ideal, so we can replace the instruction thus: Instead of going through the closed window: say "The window is shut: you'd break the glass." Test me with "look through window / climb through window / open window / climb through window / look through window / close window / e / open window / e".

19
| Example Garibaldi 1 Providing a security readout device by which the player can check on the status of all doors in the game.

Previous | Contents | Next