An action by any other name: Finding the names of actions in Inform 7

One thing that seems to trip authors every time in I7 is finding the name of the action to work with. Here are some hints for finding the name of the action when you encounter the "that did not make sense as a description of an action" error.

Let's say we have in our game a coin and a slot machine and we would understandably want to handle PUT COIN IN MACHINE somehow. So we write this:

The Casino is a room.
A slot machine is in the Casino. The player carries a coin.
Instead of putting the coin in the slot machine:
say "The coin falls through the machine and straight into the winnings tray. It must be broken."

Looks all good, right? But when we try it, the compiler says this:

Problem. You wrote 'Instead of putting the coin in the slot machine' , which seems to introduce a rule taking effect only if the action is 'putting the coin in the slot machine'. But that did not make sense as a description of an action. I am unable to place this rule into any rulebook.

This happens because "putting it in" is actually not the action's name. Even though when playing the game one action can have several verbs that are synonymous (eg. TAKE and GET do exactly the same thing) but in the code each action has only one name (eg. taking). Actions are like those demons in folklore where you have to know their true name before you can control them.

How do you find an action's real name then? There are a couple of ways, but these two are probably the easiest.

The first method is to open the index page and take a look at the Actions tab. (This is the Mac IDE, the Windows and possibly Linux versions have the buttons in slightly different places.)

Actions tab in Inform 7

This page lists all actions and all verbs that are available in-game. Scroll down the page and find "put".

The put verb in the actions tab

The command PUT has different meanings depending on the context but the line we want in this case is "put [other things] in/inside/into [something]". This shows the name of the action: inserting it into.

The drawback of this method is that the index tab is not always available if there was a problem compiling the game, so you might not get to see the list without trimming the non-working parts of the code and compiling again. There's another way of finding the name of the action right in the game itself. Go to the game running in the IDE (where the debugging verbs are available), type ACTIONS to turn the actions listing on and then the command you wish to manipulate (although this suffers from the same problem as the index in Linux and possibly Windows IDE; see the comments below):

>actions

Actions listing on.

>put coin in machine

[inserting the coin into the slot machine]
That can't contain things.
[inserting the coin into the slot machine - failed the can't insert into what's not a container rule]

The emphasized line shows that the action that the game tries is "inserting it into", which is the name of the action we need to use in our case.

5 thoughts on “An action by any other name: Finding the names of actions in Inform 7

  1. Useful advice, but... doesn't your second technique have the same problem as the first, i.e. to get the game running in the IDE you need to first compile it successfully? :)

  2. The difference is that once you have compiled the game once it doesn't stop running even if later compilations fail. So if you have compiled successfully once and the game hasn't crashed, you're good to go. If you have just opened the IDE and started writing right away then you might have to make the game compile even once to access either the index or the game.

  3. The other way I get this information -- and I hate to say this, because it's hard to make it look newbie-friendly -- is to keep the Standard Rules file open in a separate window.

    Searching through the Standard Rules is my first route to finding I7 syntax, I'm afraid.

  4. "The difference is that once you have compiled the game once it doesn’t stop running even if later compilations fail."

    This may be true in the OSX IDE, but it isn't the case in the Linux IDE. Probably not in the Windows IDE either, judging from Jimmy's remark.

Comments are closed.


Did you find this article useful? By subscribing to the blog's mailing list you will receive an email whenever a new blog post is published. The address won't be used for any other purposes.