This resource guide is part of the electronic literature critical making series, which discusses creative tools for authoring electronic literature. Learn more about electronic literature at UC Berkeley.
Inform 7 is a free, open-source tool for creating text-based interactive fiction (IF). Works in this genre typically feature an interpreter and a compiler. The interpreter provides descriptions to the reader and accepts a limited range of commands such as: “go north”, “take mug”, “examine orange”, “open chest”. The compiler takes source code provided by the author and verifies whether the verbs and objects relate to each other in valid ways.
Moving through the narrative of an IF work requires active participation and investigation by the reader (sometimes called the interactor). IF works may have multiple “endings.” Other works of IF may offer no conclusive ending at all. See examples below.
Inform 7 has a rich set of features that go far beyond what will be covered in this beginner’s guide. To gain a more advanced understanding of Inform, consult Writing with Inform (a thorough walkthrough of Inform’s features) or The Inform Recipe Book (a collection of example source code and advice on advanced implementations).
Operating the software
Begin by downloading the latest version of Inform 7. When you first open the program, you will see two panes to work with. Use the tabs on right side of each pane to access other materials.
You will primarily be working with the “Source” tab, where you will compose the source code for your story, which will be hidden from your reader. Use the “Story” tab to test out your story from the reader’s perspective. Each time you want to test your story, press the “Go!” button to compile your code. Inform may indicate errors in your code and prevent you from playing your story until you correct them.
The “Index” tab provides helpful information about Inform’s capabilities and the world you have created. The Index includes a list of valid verbs that can be used in Inform. As you build out the physical layout of your world and fill it with objects, the Index also provides a visual map of your world and an inventory of objects.
Writing a story
This section will focus entirely on writing source code. There are generally three kinds of text found in Inform source code:
- passive description
- active description
Assertions typically appear as unadorned, black text in the source code. Assertions, written as plain English sentences, create objects, people, or spaces and define the possible set of interactions available to the reader. Because Inform tries to mimic natural language, there are often several ways to create the same objects. Assertions are not visible to the reader.
- The cash register is a container in the Diner. The cash register is closed. The cash register is locked.
- The drawer is a closed, locked, container in the Diner.
- The Diner is a room. The Kitchen is a room north of the Diner. South of the Diner is the Storefront.
Descriptions are enclosed in quotes and appear as blue, bolded text in the source code. Descriptions are revealed to the reader as they interact with the story. Description text should contain useful clues to the reader for how to interact with objects and people in the world. Description text is also where you can provide colorful and thick description to make your text more lively.
The important distinction is between passive and active descriptions. Passive descriptions appear when the reader enters a room. Active descriptions are only revealed after the reader types a command such as “examine mug” or “look at mug.” Active descriptions take the format of: The description of [object / person] is “[description]”.
Example source code:
- Create a person with an assertion: Betty is a woman in the Diner.
- A passive description of the Diner and Betty: "Some tabloids are piled in a stack by the register. The waitress is busy shouting orders and checking in with customers. Her nametag, peeling off her uniform, reads 'Betty.'”
- An active description for Betty that appears when you use the command “examine Betty”: The description of Betty is “Betty looks pretty tired.”
- Define object properties:
- The glass case is a closed, locked, transparent container in the Diner. The glass case is fixed in place.
- The mug is a portable container in the Diner.
- The box is an openable container in the Diner.
- Tip: always remember to place your objects in a room!
- Create a person (Consult the Inform Recipe Book for more detailed information about creating and interacting with characters):
- Betty is a woman. Betty wears an apron. The description of the apron is “The apron reads, ‘Fat Moe’s Diner.’”
- Create rooms:
Inform uses a strict grid structure to define space. To make rooms accessible, you must indicate how they are connected to other rooms.
- The Diner is a room. The Kitchen is a room north of the Diner. The Lobby is a room southwest of the Diner. The Attic is above the Diner. The Cellar is below the Diner.
If / else statements
Inform allows you to create descriptions that change according to the state of objects in the environment. For example, the description of a room might change if a container is open or closed. If / else statements are denoted with square brackets.
- The Kitchen is a room. The description of the Kitchen is “[if the cabinet is closed] Everything is neatly tucked away in cabinets [otherwise]Pots and pans spill out of the open cabinet[end if].”
Readers may become confused by ambiguities in your description text. In the examples above, we used an assertion to create a woman named Betty. In the description text, she is first introduced as a waitress (Betty is a woman in the diner. “The waitress is busy shouting orders and checking in with customers. Her nametag, peeling off her uniform, reads 'Betty.'”). When the reader tries to “Examine waitress”, they will receive a confusing message from the interpreter (“You can't see any such thing.”). To make “waitress” equivalent to “Betty”, use the following assertion:
- Betty is a woman in the Diner. Understand “waitress” as Betty.
As an author, you may want to limit the ways in which a reader can interact with certain objects. For example, you may want to prevent users from picking up an object and placing it in their inventory. Use the following assertion:
- The diner contains a cat.
Instead of taking the cat: say “But how would you catch it?”
- Betty is a woman in the diner. Instead of asking Betty for coffee: say “Betty growls, ‘Your cup is already full!’”
By default, the interpreter will list off all objects in a room. This can ruin a reader’s experience of surprise or discovery.
- For example, enter the following source code:
- The Diner is a room. The Diner contains a box. The box is closed. The box contains a photograph.
- The interpreter automatically returns the description text:
- You can see a box (in which is a photograph) here.
Perhaps you want to force the reader to examine the box to discover the photograph. To conceal the photograph, use the following combination of description and assertion.
- The Diner is a room. The Diner contains a box. The box contains a photograph. The photograph is undescribed. The description of the box is “You look in the box. The box contains a wrinkled photograph.”
To learn more about the creative possibilities in Inform, play some of the IF works listed in the Interactive Fiction Database. To play works of interactive fiction created by other authors, you will need to download an interpreter. Below are some selected examples of IF:
- “Aisle” by Sam Barlow
A piece of interactive fiction with many different endings that invites the reader to regret and replay.
- “Savoir-Faire” by Emily Short
A good introduction to the genre. “Savoire-Faire” features a thorough help menu and rich description text.
- “Glass” by Emily Short
You are a parrot trying to influence the flow of conversation between Cinderella, her step family, and the prince. Convincing dialogue and character interaction can be difficult to implement in Inform. “Glass” takes an interesting approach to conversation.
Studying other authors’ source code (when it’s available) is another great way to learn about how you can use Inform.
- The Disenchantment Bay tutorial from The Inform Recipe Book
- The story used in this guide’s example texts
Images: (1) Screenshot of the Inform 7 editor. Source code is displayed on the left. A story is playing on the right (2)The “Map” subsection of the Inform 7 Index