Inform 7 Home Page / Documentation
Chapter 3: Things
§3.1. Descriptions; §3.2. Rooms and the map; §3.3. One-way connections; §3.4. Regions and the index map; §3.5. Kinds; §3.6. Either/or properties; §3.7. Properties depend on kind; §3.8. Scenery; §3.9. Backdrops; §3.10. Properties holding text; §3.11. Two descriptions of things; §3.12. Doors; §3.13. Locks and keys; §3.14. Devices and descriptions; §3.15. Light and darkness; §3.16. Vehicles and pushable things; §3.17. Men, women and animals; §3.18. Articles and proper names; §3.19. Carrying capacity; §3.20. Possessions and clothing; §3.21. The player's holdall; §3.22. Food; §3.23. Parts of things; §3.24. Concealment; §3.25. The location of something; §3.26. Directions
|Contents of Writing with Inform|
|Chapter 2: The Source Text|
|Chapter 4: Kinds|
|Indexes of the examples|
At its simplest, the interactive fiction will be simulating a physical world to explore. The forerunner of today's IF is generally agreed to be a computer simulation by Will Crowther of the exploration of a cave system in the Mammoth and Flint Ridge chain of caves in Kentucky, a part of which might be described in Inform thus:
The Cobble Crawl is a room. "You are crawling over cobbles in a low passage. There is a dim light at the east end of the passage."
A wicker cage is here. "There is a small wicker cage discarded nearby."
The Debris Room is west of the Crawl. "You are in a debris room filled with stuff washed in from the surface. A low wide passage with cobbles becomes plugged with mud and debris here, but an awkward canyon leads upward and west. A note on the wall says, 'Magic word XYZZY'."
The black rod is here. "A three foot black rod with a rusty star on one end lies nearby."
Above the Debris Room is the Sloping E/W Canyon. West of the Canyon is the Orange River Chamber.
Here we sketch in four of Crowther's locations, and two objects: just enough to be able to walk around the caves and pick up the rod and the cage. The text in quotation marks will appear verbatim as paragraphs shown to the player as the caves are explored. The first paragraph, as we have seen, is the title of the work. The other quotations describe the places and objects introduced.
If we play this story, we find that we can type TAKE CAGE or TAKE WICKER CAGE, for instance, but not TAKE SMALL CAGE. Inform saw that we called this "a wicker cage" when it first appeared in the source text, and assumed that the player would call it that, too. (Whereas it didn't look inside the descriptive text to allow for TAKE SMALL CAGE or TAKE DISCARDED CAGE or TAKE NEARBY CAGE.) A small limitation here is that probably only the first 9 letters of each word are read from the player's command. This is plenty for handling the wicker cage and the black rod, but it might be embarrassing at a meeting of the Justice League to find that KISS SUPERHERO and KISS SUPERHEROINE read as if they are the same command.
So we have already found that Inform has made some assumptions about what we want, and imposed some limitations on how much computational effort to go to when the work of IF is finally played. If Inform guesses what we need wrongly, we need to know more advanced features of the language in order to overcome these problems. (We shall see how to change the way the player's commands are read in the chapter on Understanding.)
This is often how Inform works: make the standard way of doing things as simple as possible to describe, but allow almost any behaviour to be altered by more elaborate source text. As an example of that, the player begins in the Cobble Crawl because it was the first room created in the source text, but we could instead have written text like:
The player is in the Cobble Crawl.
to override that. This can make the source text easier to follow if the rooms are sometimes being created in a less obvious way. For example, if we write:
The silver bars are in the Y2 Rock Room.
The Cobble Crawl is a room. South of the Crawl is Y2.
then the first room to be created will actually be the Y2 Rock Room, so that's where the player will be starting unless we say otherwise.
|Start of Chapter 3: Things|
|Back to Chapter 2: The Source Text: §2.16. Does Inform really understand English?|
|Onward to §3.2. Rooms and the map|
It may occasionally be useful to check whether all objects in our game have a given property. Here we have a "not for release" section that will run at the start of the game and alert us to any objects lacking description:
By default, the description of a room is printed every time the player enters a room.
On a device with very limited screen space, however, we might wish to supplant that behavior with "brief" descriptions. In Brief mode, Inform prints room descriptions only when the player enters that room for the first time. Afterwards, the text is skipped, for brevity, though the player can see it again at any time by typing LOOK.
As we saw in the previous chapter, we can set "use options" to control certain aspects of the player's experience. One of the use options is the option to
which changes the defaults so that the description of a room is printed only the first time the player enters.
The Wilkie Memorial Research Wing is a room. "The research wing was built onto the science building in 1967, when the college's finances were good but its aesthetic standards at a local minimum. A dull brown corridor recedes both north and south; drab olive doors open onto the laboratories of individual faculty members. The twitchy fluorescent lighting makes the whole thing flicker, as though it might wink out of existence at any moment.
The Men's Restroom is west of the Research Wing. "Well, yes, you really shouldn't be in here. But the nearest women's room is on the other side of the building, and at this hour you have the labs mostly to yourself. All the same, you try not to read any of the things scrawled over the urinals which might have been intended in confidence."
If we type "test me" during play, these commands will be carried out automatically, and we can see that when we return to the Research Wing, the description is not given a second time.
Some notes: the player can also turn full-length descriptions on or off with the commands "verbose" and "brief", or set a minimal-description setting with the command "superbrief". This power still belongs to the player even if we have set the use option to show brief room descriptions by default.
Moreover, we can ourselves check what the state of the descriptions is, with
Finally, it is possible to exercise more precise control over what the player sees on his first and subsequent visits to a room; see the next example for details.
A fairly common effect in interactive fiction is a room which is described differently on the first visit than on subsequent visits. We can produce this effect as follows:
Awning is a room. "A tan awning is stretched on tent poles over the dig-site, providing a little shade to the workers here; you are at the bottom of a square twenty feet on a side, marked out with pegs and lines of string. Uncovered in the south face of this square is an awkward opening into the earth."
Slightly Wrong Chamber is south of the Awning. "[if unvisited]When you first step into the room, you are bothered by the sense that something is not quite right: perhaps the lighting, perhaps the angle of the walls. [end if]A mural on the far wall depicts a woman with a staff, tipped with a pine-cone. She appears to be watching you."
Note the "[if unvisited]..." in the description of the Slightly Wrong Chamber. A room is considered to be "unvisited" until after the player has seen its description for the first time.
The bracketed text creates a special rule for printing; we will learn more about these in the sections on text with variations and text with substitutions.
Some further fine print: we might write our condition as "if unvisited", "if the location is unvisited", or "if the Chamber is unvisited" -- all of these constructions would be acceptable, but in the absence of more specifics, the condition is understood to apply to the object whose description it is.