Inform 7 Home Page / Documentation
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. Le Guin'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.
So much for creating and describing individual doors. Once we need to write about doors in general, we are likely to want a way to find out where a given door sits in the map. The following phrases reveal this:
front side of (object) ... room
This phrase produces the first of the one or two rooms containing a door - first in the order given in the source text. Example: if
then "front side of the red rock stair" produces the Orchard. For a one-sided door, this produces the only room containing the door.
back side of (object) ... room
This phrase produces the last of the one or two rooms containing a door - last in the order given in the source text. Example: if
then "back side of the red rock stair" produces the Undertomb. A one-sided door has no "back side."
More often, we are dealing with a door and want to know what it leads to, but that depends where we're standing:
other side of (door) from (room) ... object
This phrase produces the room on the other side of the door, as seen from the given vantage point, which needs to be one of its sides. Example: if
then "other side of the red rock stair from the Undertomb" produces the Orchard, and vice versa.
direction of (door) from (room) ... object
This phrase produces the direction in which the door leads, as seen from the given vantage point, which needs to be one of its sides. Example: if
then "direction of the red rock stair from the Undertomb" produces up.
See Adjacent rooms and routes through the map for more phrases which can look at the current map layout
|Start of Chapter 3: Things|
|Back to §3.11. Two descriptions of things|
|Onward to §3.13. Locks and keys|
Disenchantment Bay 5
We mentioned that there is a door out to the deck in our example. The following two sentences will create both the door and the other room:
Now Inform has constructed a generic room called "Deck" to the south. It has neither a description nor any contents yet, but we could fix that in time. It does have a view of the glacier, though, since we defined the glacier view to be everywhere.
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.
Now we have a "bedroom window" object which can be entered. Now, to catch the case where the player types "LOOK THROUGH 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:
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):
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:
Suppose we would like to allow the player to view the status of all the doors functioning in the game; and we want to identify those doors by mentioning which two rooms they connect. The following uses some techniques that will be covered in later chapters, but the basic idea may be obvious:
Instead of examining the switched on security readout:
say "The screen reads: [fixed letter spacing]";
say line break;
repeat with item running through doors:
say line break;
say " [item] ([front side of the item]/[back side of the item]): [if the item is locked]LOCKED[otherwise]UNLOCKED[end if]";
say variable letter spacing;
say paragraph break.
It is more or less arbitrary which room winds up as the "front side" and which as the "back", but in this case it hardly matters.
The Docking Bay is a room. The inner airlock is a door. It is north of the Docking Bay and south of the Zocalo. The inner airlock is lockable and unlocked. The outer airlock is lockable and locked. It is a door. It is south of the Docking Bay and north of Space.