Featured Blog

Learning Inform 7: Part 2

Part 2 of the Learning Inform 7 series builds on the concepts introduced in Part 1. It covers people, time, scenes, and connecting rooms.

[I highly recommend reading Part 1 before this one. While much of the information can be understood separately, the ongoing story and many basic concepts were outlined earlier. This part will build on those ideas and further explain their functionality.]

By default, Inform 7 does not track the plot of a story. Action happen and events occur consecutively, but there is no division of story progression into anything more than the current running session. However, time itself is tracked.

Unless overwritten, all stories start at 9 AM and each turn takes one minute. Because time is a special kind of value though, it can be set like any other using the “is” keyword as part of any other rule. From that point onward, time will flow normally per turn.

The time of day is 10 AM.

This specialized functionality allows the special keyword “at” to define rules in reference to the current time. Interactions can be triggered when their conditional time is reached. A story can be, if wanted, constructed as a series of events along a time continuum.

The time of day is 10 AM.

At 10:01 AM:
     say "Time's up! (The time is [time of day].)"

Note: For Inform 7 to “say” a kind of value, it must be enclosed within square brackets as part of quoted text. Otherwise, it will assume the content is merely text itself.

However, such an approach could grow to be tedious to write. Nor would it make sense for stories that do not depend on time to explicitly state numerous rules about it. To solve this problem, Inform 7 has Scenes.

A scene is a kind of thing which has a beginning and an ending. Each running session is a scene called Entire Game which starts when play begins and ends when the instance is closed somehow. It recurs when play is resumed.

Like all other things used during play, Inform 7 keeps track of Scenes through the Index tab. This catalogs all Scenes defined in Source, including by default Entire Game, and all timed events as well. It also lists their beginning, ending, and recurring properties.

The value of “play” is special. It exists in reference to the scene Entire Game beginning (for the first time) or ending. Because of this, rules can written to take place “when play begins” or “when play ends” to override the default introduction or even to “say” something extra to the player when play is done.

"The Adventures of Flippr" by Dan Cox

When play begins:
      say "The ocean is vast. It carries adventures big and small to those willing to brave its waves and struggle with its currents. Few pass with ease through its beautifully tumultuous depths. Few, that is, except for Flippr, the 'faster than lighting' dolphin."

Because scenes start as part of conditional statements, they can also be associated with “play” beginning too. In other words, a scene can begin when play begins. All that is needed is to define something using the phrase “is a scene” and then assert when it begins.

Act 1 - Flippr Eats Fish is a scene.
Act 1 - Flippr Eats Fish begins when play begins.

Note: The convention is to use capital letters for the name of scenes. However, as with much of Inform 7, such usage and styling is completely up to the story author.

Without explicitly giving a scene an end, it will continue indefinitely. While this could be useful for some stories, most authors will want to define multiple scenes and connections between them. Then, using conditional transitions, the appearance of plot progression can be created for the player as interactions or even time advancement triggers the next scene in order.

"The Adventures of Flippr" by Dan Cox
Act 1 - Flippr Eats Fish is a scene.
Act 1 - Flippr Eats Fish begins when play begins.
Act 2 - The Missing Sailor is a scene.
Act 2 - The Missing Sailor begins when Act 1 - Flippr Eats Fish ends.
Act 3 - The Mystery Solved is a scene.
Act 3 - The Mystery Solved begins when Act 2 - The Missing Sailor ends.
Act 1 - Flippr Eats Fish ends when the time since Act 1 - Flippr Eats Fish began is 10 minutes.

While it is often useful to think of scenes using the metaphor of discrete literary units of stories, they are not limited to such concepts. Like other objects in Inform 7, scenes have properties, descriptions, and can have kinds of values as well. They can be treated as logical sections of a story and as a way to provide maintenance or re-initialize information and data.

Defined as such, the beginning or ending of a scene can be used to move the player, add something to a room, or change the values of kinds. In fact, with the keyword “now” as part of any conditional statement, properties and things can be changed programmatically instead of explicitly written as separate rules. Using a series of statements connected to when a scene begins, for example, an author could move the player to a new room, change the time, and prepare new interactions.

Act 1 - Flippr Eats Fish ends when the time since Act 1 - Flippr Eats Fish began is 10 minutes.

When Act 1 - Flippr Eats Fish ends:
     say "As the light fades, you know it is time to head inside the Beach House owned by your mother, renown marine biologist Jessica M. Norstrand."

Act 2 - The Missing Sailor is a scene.
Act 2 - The Missing Sailor begins when Act 1 - Flippr Eats Fish ends.

The keyword “now” makes a statement true if it is possible within the context and for the given kind of value. It is used primarily to change something after play has begun as part of an extended conditional statement. Often, it is useful to mutate a kind of value as a result of something the player does or as the result of another event.

When Act 2 - The Missing Sailor begins:
now the player is in the Beach House;
        now the time of day is 8:30 PM; The Beach House is a room.

Just like animals, Inform 7 also has a person kind of thing. A person can, if specified, be male or female. However, like with defining kinds of animals, a new kind of person can be added to stories as well.

A marine biologist is a kind of person.
Jessica Norstrand is a marine biologist in the Beach House.

Because the player a person too, they can also be assigned to be a different person if needed. By simply asserting at any moment that the player “is” that person, the player gains control over that other person. All rules that exist that govern that person now also affect the player.

Diana Norstrand is a woman in the Seaside. The description of Diana Norstrand is "Diana Norstrand is 12 years old. Her best friend is Flippr the dolphin." The player is Diana Norstrand.

Another kind of thing commonly found in stories is a device, something that can be switched on or off. Usually electrical or mechanical in nature, objects can be defined as devices to allow the player to interact with them beyond examining, taking, or dropping. They can also be associated with more complex chains of interactions dependent on whether an initial device is switched on or not.

The radio is a device. The radio is switched on. The radio is in the Beach House.

Instead of switching off the radio, say "Your mother tells you to leave it alone."

Rooms, as objects that hold things, can be connected to each other through asserting the path direction to travel from one to another. These connections are then matched to their opposite pairs in the other room. Thus, for example, “going west” into a room followed by “going east” would place the player in the same starting location again.

Note: There are twelve default directions built into Inform 7: north, northeast, northwest, south, southeast, southwest, east, west, up, down, inside, and outside.

The Seaside is a room. "The beach stretches off into the distance as the waves gently crash upon its shore." North Seaside is north of Seaside. South Seaside is south of Seaside.

To help story authors visualize the layout of their worlds, Inform 7 constructs a map and index of all the rooms and how or if they are connected to each other. Found under Index and then the World tab, Inform 7 will list the current rooms, their contents, and directional associations between them.

For those stories with multiple rooms, a region can be used to collect sets of rooms and refer to them as a group. Rules can be written that affect those specific rooms without having to individually list them. Such grouping will also color-code the rooms as part of a region on the World Index.

The Central Seaside is a room. "The beach stretches off into the distance as the waves gently crash upon its shore."

North Seaside is north of Seaside. South Seaside is south of Seaside.

Oceanfront is a region.
Central Seaside, North Seaside and South Seaside are in the Oceanfront.

The Living Room is a room. "A well-used couch is positioned in the middle of the room with a television across from it. Paintings of various ocean scenes fill the walls on all sides."

The Kitchen is west of the Living Room. "Pot and pans line the walls." Your

Bedroom is northwest of the Living Room. "Clothes, toys, and your drawings cover most of the floor except for a small path from the door to your bed."

Mother's Bedroom is northeast of the Living Room. "The room is always tidy. Your mother likes things organized."

The Beach House is a region. Living Room, Kitchen, Your Bedroom and Mother's Bedroom are in the Beach House.

(Optional: To help the player understand her placement within a group of connected rooms, I frequently include the following code, which will be explained in a later part of this series, as a way to explicitly tell the player all viable directions out of a room.)

Definition: a direction (called thataway) is viable if the room thataway from the location is a room.

After looking:
     let count of exits be the number of viable directions;
     if the count of exits is 0:
          say "(There are no routes out of this room.)";
          say "(From here, you can move to [a list of viable directions].)"; continue the action.

All scenes, as was previously covered, have properties like turn counts and if they are happening. The number of actions taken during play, for example, are counted and recorded as the skein and transcript of a session. This also means that rules can reference the location, turn count, and the status of a scene as part of a conditional statement.

Every turn during Act 1 - Flippr Eats Fish:
     if the location of Flippr is not the location of the player: now Flippr is in location of the player.

Note: The player’s actions nearly always precede that any programmed response unless specific rules are written to override it.

(This is the end of Part 2.)

Latest Jobs

IO Interactive

Hybrid (Malmö, Sweden)
Gameplay Director (Project Fantasy)

Arizona State University

Los Angeles, CA, USA
Assistant Professor of XR Technologies

IO Interactive

Hybrid (Copenhagen, Denmark)
Animation Tech Programmer

Purdue University

West Lafayette, IN, USA
Assistant Professor in Game Design and Development
More Jobs   


Explore the
Advertise with
Follow us

Game Developer Job Board

Game Developer


Explore the

Game Developer Job Board

Browse open positions across the game industry or recruit new talent for your studio

Advertise with

Game Developer

Engage game professionals and drive sales using an array of Game Developer media solutions to meet your objectives.

Learn More
Follow us


Follow us @gamedevdotcom to stay up-to-date with the latest news & insider information about events & more