| Chapter 6: Descriptions |

| 6.7. Adjacent rooms and routes through the map

Another useful adjective built into Inform is "adjacent". Two rooms are said to be adjacent if there is a map connection between them which does not pass through some barrier such as a door. This is easily tested:

> if the Hallway is adjacent to the Study ...

We usually want to know about the places adjacent to the current scene of the action, so that is what the adjective "adjacent" means when applied to rooms. For instance:

> if somebody is in an adjacent room, ...

As with the case of "visible", the adjective is a cut-down version of the more general relationship. This often happens: "worn" and "carried", for instance, imply "by the player" unless something else is specified.

If we want to ask a more direct question, we can obtain specific map connections like so:

> say "You look north into [the room north from the Garden]."

since "the room D from A" produces the room which lies in direction D from room A. We need to be a little careful here. What if there is no map connection this way? In that case, "the room ... from ..." produces the special value "nothing". Thus:

> if the room north from the Garden is nothing, say "The grass leads nowhere."

While on the subject of navigating the map, the phrase "the best route from A to B" gives a direction to take in order to get from A to B by the shortest number of movements between rooms - if there is any way through at all. For example, here is a lure:

> The description of the brass compass is "The dial points quiveringly to [best route from the location to the Lodestone Room]."

Best routes are ordinarily forbidden to go through doors, but if the suffix "using doors" is added as an option then any open or openable and unlocked door may be used on the way; and if "using even locked doors" is given, then any door at all will do. Since magnetism is no respecter of property, that seems right here:

> The description of the brass compass is "The dial points quiveringly to [best route from the location to the Lodestone Room, using even locked doors]."

The phrase "the best route from A to B" gives the direction to take next, if we are at A and want to end up at B. Suppose this is east. We can find out where we go next by looking up "the room east from A": similarly for any other direction, of course. (This can see through any doors, locked or not.)

We can also stipulate that only certain rooms may be used for the journey, as in the following example:

> best route from the Drawbridge to the Keep through visited rooms

The condition - in this case, that "visited rooms" must be used - also applies to both ends of the journey. (Also, saying something like "...through containers" would mean there is never a route, since it is only rooms which appear on the map.)

Lastly, we can find out how long the journey would be:

> The description of the proximity gadget is "You are now [number of moves from the location to the Sundial] moves from the Sundial.";

This number is, of course, 0 if the location is already the Sundial. If there is no way at all to get to the Sundial, the number is -1.

62
| Example Mistress of Animals A person who moves randomly between rooms of the map.

63
| Example All Roads Lead to Mars Layout where the player is allowed to wander any direction he likes, and the map will arrange itself in order so that he finds the correct "next" location.

64
| Example Hotel Stechelberg Signposts such as those provided on hiking paths in the Swiss Alps, which show the correct direction and hiking time to all other locations.

65
| Example A View of Green Hills A LOOK [direction] command which allows the player to see descriptions of the nearby landscape.

Suppose a game in which the player is wandering an open landscape with long vistas, allowing him to LOOK in some direction, or even look at an adjacent location. "A View of Green Hills" Corinth is a room. Athens is east of Corinth. Epidaurus is southeast of Corinth and east of Mycenae. Mycenae is south of Corinth. Olympia is west of Mycenae. Argos is south of Mycenae. Thebes is northwest of Athens. Pylos is south of Olympia. Sparta is east of Pylos and south of Argos. Delphi is northwest of Thebes. Understand "look [direction]" as facing. Facing is an action applying to one visible thing. Carry out facing: let the viewed item be the room noun from the location; if the viewed item is not a room, say "You can't see anything promising that way." instead; try looking toward the viewed item. In rules about action handling, "noun" refers to the first object that the player has mentioned in his command, so if the player typed >LOOK WEST, "let the viewed item be the room noun from the location" would be processed as "let the viewed item be the room west from the location", and so on. We can at need override the default behavior, if it is not going to be appropriate for the player to see the next room over. There is only sky above at any time, so... Instead of facing up: say "Above you is bright sky." Understand "look toward [any adjacent room]" as looking toward. Understand "examine [any adjacent room]" as looking toward. Looking toward is an action applying to one visible thing. Carry out looking toward: say "You make out [the noun] that way." This design allows us to create descriptions for rooms (as seen from the outside) which will work regardless of where we're looking from. For instance: Instead of looking toward Athens: say "Even from here you can make out the silhouette of the Acropolis." Test me with "look north / look south / look up / look east / east / look west".

Previous | Contents | Next