What is time, and what things happen in it?
a brief introduction to time.
If you have played a parser game, then you are familiar with the concept of the “turn.” A player types a command, and, if it is recognized, will be provided with in-game feedback. Here’s a mainstay dating back to Zork I (this one is from release 26):
> jump
Wheeeeeeeeee!!!!!
This, in a parser game, is a turn. There is almost always some machinery moving in the background, but at the most basic level, the turn consists of command and feedback together in text.
As already implied, the mechanism that advances the turn count or time in-game is the player’s action. Actions generate player feedback. Feedback text, as we’ve already discussed, can vary based on conditions. Such feedback is therefore conditional. Actions can also change the state of the game world. For instance, in episode 1, I talked about wearing the lab coat. This action (wearing) changed the state of the world (now the coat can be characterized as “worn by the player”).
Therefore, player actions can be thought of in two ways: creating conditional feedback (printing text) and checking or changing the state of the game world. In a very literal sense, every action changes the state of the game world by adding to the turn count, a number tracked within every Inform 7 game. How are actions handled in an Inform 7 project?
what turns are made of.
The Inform 7 turn is a complicated beast. Fortunately, Inform 7 was designed to shield authors from much of this complexity. Even so, Inform is capable of incredible levels of simulation in a game world. Both background simulation and direct player action are handled on a per-turn basis. The turn is the basic unit of experience in an Inform game. Everything happens within turns. Most of Inform’s machinery is meant to work without our help or intervention, so my early discussions will focus on player actions. After all, turns only occur in response to command input from the player, and, in almost every case, player input consists of actions.
To understand turns at a fundamental, beginning level, we must first understand what actions are and how they occur across turns.
creating and referencing actions.
To start, an action is usually characterized as a present participle (it can handle other tenses, but that will usually be unimportant). Since I’ve already discussed wearing the lab coat, here’s how that action is defined in the Standard Rules.
Wearing is an action applying to one carried thing.
Understand "wear [something preferably held]" as wearing.
“Wearing” is the name of the action. Rules involving the action will refer to it by name, “wearing.” “Applying to…” creates a specification for how the action is processed with regard to nouns. Inform 7 actions can apply to no nouns, one noun (direct object), or two (direct and indirect object). In naming and defining an action, we are also telling Inform how to use it. Players (and authors) must adhere to these definitions. For instance, “jumping is an action applying to nothing” (i.e., has no direct object). If the player attempts to use a direct object with the jumping action, Inform will return an error message.
>jump hat
I only understood you as far as wanting to jump.
Restated, a defined action
- must have a name (generally a present participle ending in “ing”).
- must specify the number of nouns involved (only nothing, one thing, and two things are accommodated out of the box).
Note that it is enough to say the number, as in “[action name] is an action applying to one thing.” Alternately, one could specify two things or nothing. You may have noticed that the wearing action goes beyond simply specifying a thing:
one carried thing.
This kind of specificity is rarely needed, and I wouldn’t venture beyond “one thing” unless you are solving a specific problem. In many code examples, it is also common to see “one visible thing” and “one touchable thing.” Inform 7 usually handles such conditions without intervention, so I would again avoid using such specifications unless you have something in mind. In almost all cases, a simple count of things involved will be more than enough.
What about the second line?
Understand "wear [something preferably held]" as wearing.
This is called command grammar. That is, this line defines the construction of the player’s command, turning the action into a recognizable format for player input. In our example of the lab coat, the coat is the “[something preferably held]”. We can guess what “[something]” would mean, that’s just a noun in the world of the game. What does “[preferably held]” mean? It doesn’t enforce anything. This simply means that, if Inform 7 is trying to guess what the player means, it will choose something held over something that is not held.
yes, but…
Alright, “[something preferably held]” does not enforce anything (reject commands, generate failure messages). You may have wondered why I haven’t talked about the definition. Is that enforced?
Wearing is an action applying to one carried thing.
The answer is “yes.” Only a carried thing can be worn, and the Standard Rules will make an effort to make things work. As a reminder:
>wear coat
(first taking the lab coat)
You put on the lab coat.
It’s early to explain how this works, exactly. The important thing to understand right now is that there is an order in which Inform 7 processes actions. It may check for action requirements in one phase, then complete the action in another. This sequence is known as “action processing,” and is the framework for handling the typical player command within the overall “turn.”
These are the author-facing (as in, no special knowledge required) phases of action processing in order of occurrence. Don’t worry about memorizing them yet!
- before: the earliest entry point in action processing. happens before many preconditions are checked.
- instead: as the name suggests, “instead” rules are good for redirecting or stopping requested actions.
- check: typically, an evaluation before processing.
- carry out: the action itself.
- after: feedback after the action is complete, typically prevents “report” rules from firing.
- report: a final message or phrase when an action is concluded.
- every turn: just as it says, a rule that is evaluated at the end of every turn. not necessarily specific to the player’s command.
A specific action may not involve all of these phases. In our “wear lab coat” command, this is what happens:
- check wearing something [the lab coat]: if the lab coat is not carried by the player, the player should take it.
- carry out wearing something [the lab coat]: now the lab coat is worn by the player.
- report wearing something [the lab coat]: “You put on the lab coat.”
If this seems like a lot, bear with me! The important thing to understand right now is that we define actions and their commands with simple sentences. These actions flow through a framework called “action processing” that is made up of distinct phases. It isn’t important to memorize them all right now. It’s enough to know that this is what we are doing when we configure actions to provide text feedback to players.
further reading.
WI 7. Basic Actions (zedlopez.github.io)
next.
Next time, I’ll try to make some basic rules for handling actions and providing text feedback. Also: why are there so many doggone phases?

Leave a comment