
Inform 7 FAQ
This is a partial list of things that people ask me frequently in different contexts; it is likely to grow. (Last updated Nov. 24, 2007.)
Learning
Is there a full description of syntax for this language? Or: is there a BNF document for Inform 7?
Yes. See the BNF or the smaller but perhaps more practical syntax list.
Where should I ask questions about my Inform 7 coding problems?
Many people provide support on the rec.arts.int-fiction newsgroup and on ifMUD.
Are there complete games whose source code I could look at?
Sure. See the Worked Examples page on the Inform 7 website. Caveat: a couple of these have not been updated to work with the latest version of syntax for the latest release (esp. the When in Rome games); but they may still be interesting to look at for some purposes.
How should I structure my code?
In whatever way you’re comfortable with. My personal preference is usually to write general rules about the world model first, then to follow with the actual rooms of the game, and put plot and scene materials (if relevant) towards the end. Your arrangement may be completely different, and to some extent it’s useful to let it be dictated by what kind of game you’re writing. If your game is very geographically structured, it makes sense to arrange your code by region; if it’s very temporally structured, then maybe making one chapter per scene will work better for you.
Trouble-shooting
I’ve written a line in my source text that begins something like “if the player is in the Library, say “Squonk.”" It doesn’t compile! Why not?
Possibly you haven’t made your if-statement part of any specific rule; see the beginning of the Review of Chapter 11 on Phrases.
I’ve written an action to let the player manipulate objects in another room, but I keep getting a “You can’t reach into the Other Room” message.
Try defining your action to apply to visible objects only. See the Advanced Actions chapter on Visible vs. touchable vs. carried.
I’ve defined an action with an understand rule to apply to something preferably carried, but it isn’t generating an implicit take.
You also need to make your action apply to carried objects only. See the Advanced Actions chapter on Visible vs. touchable vs. carried.
I’ve written an action, but it doesn’t seem to fire when I use the command in question.
Compile your game, then type ACTIONS, then issue the command you think should cause your action to occur. This will tell you a) whether you’re generating the right action at all, and b) if so, whether you’re getting stopped by a check rule. If the right action is not occurring, then the problem is probably that you haven’t constructed your understand rules correctly (see the chapter on Understanding); if it is occurring but getting stopped, then maybe the action rules are designed wrong (see Advanced Actions, and also the Index on Actions, which may be able to give you details on the specifics of the action).
TAKE ALL keeps trying to take backdrops, or scenery, or other stuff I don’t want it to.
See the Activities chapter on the rule for deciding what all includes.
Foreign Languages
Can I7 be used to write games in languages other than English?
It’s not easy, but it has been done in Spanish and, I think, in French. The best place to go for help and advice on translation is the rakontointeraktiva group.
Presentation
Can I7 games be set up to be played over a web browser?
Yes. There are a couple of options, if you’re compiling for the z-machine; the one I think looks best is the one called the Z-machine Preservation Project (or ZMPP for short); I have also put up a demonstration of ZMPP running an Inform 7 game.
If you’re compiling to Glulx, you may instead want to look at Zag.
Can I7 games be bundled with executables so the player just has to click to play?
For some platforms. I don’t honestly encourage this in most circumstances, because many modern interpreters are designed to provide an iTunes-like front-end to your IF collection, not to present a single game. However, if you’re determined, see Bundlemonkey.
Does I7 support multimedia (sounds, images, etc.)?
To a limited extent, and more with each release: at the time of writing, Inform permits the creation of Glulx games with illustrations either in the main text window or in a separate window; the creation of short animations in a separate window display; the playing of sounds in AIFF and Ogg Vorbis; the use of hyperlinks; and mouse input accepted in a graphical window, which means that you can design something like a clickable compass rose. There are limitations in what the interpreter built into each application will do, currently: though you can export a mouse-using Glulx file from Windows Inform, hyperlinks and mouse input don’t work in the built-in terp, while Mac Inform does not correctly play sounds from the built-in interpreter. Work is still being done here.
Those using these features may be interested in the extensions on the Inform 7 extensions page listed under “Screen Display”.
If these extensions don’t cover all you want to do, you may have to branch out and code your special interface using inclusions of Inform 6; see Adam Cadre’s Gull guide for more on what is possible in this line. It may also help to look at the existing Glulx extensions in order to get an idea of how they hook into the existing system.
Does Inform 7 support real-time games?
There’s no built-in syntax to do this, but both the z-machine and Glulx are capable of real-time behavior, if you wanted to roll your own. Timed events may not yet be fully supported by the Glulx interpreter in the Windows application, but this might be possible to solve by outputting the game and trying it in another interpreter.
Could Inform 7 be used to build multi-player games, or to program a MUD?
Yup. See this announcement for an I7-based multi-player environment. You can add your own realms and compile its Inform code right there on the server.
Could Inform 7 games be displayed with an alternative interface, say in Flash?
Not easily. It is conceivable to write your own interpreter for Glulx or z-machine games, and to give them special features, but it would be up to you to design such an interpreter from the ground up.
Does I7 allow you to manipulate external files or read external URLs?
Yes, and sort of, respectively. Though there is no built-in browsing capacity, I7 can write out and read in files; if it is running on a machine with an accompanying script (for instance), the script can write requested information to a file that the game can then load. See the chapter on Figures, Sounds, and Files.
Specific coding questions
How do I change the default messages? Or: how do I use first or third person responses, or past tense, in my library messages?
A light-weight way is to remove or change the rules that generate responses to specific actions. This is best if you just want to change a handful of responses.
Sometimes people also want to change the tone of the entire library, though, or — as mentioned in the question — use a different person or tense. If so, see David Fisher’s Library Messages extensions on the extensions page. It is possible that at some point this kind of thing will be built directly into Inform, but we have been cautious about it because it adds a great deal of storage overhead if the author does not need this kind of thing, and because we have not yet agreed on the best way to present such functionality to the author.
In the meantime, the extensions work. “Default Messages” lets you replace messages; “Custom Library Messages” adds an automatic handling for other persons and tenses.
How do I suppress the description of an object which is on a scenery supporter during a room description? Inform keeps printing “On the table you see…”, but I’d rather mention the object differently or not at all.
It is an annoying corner of the implementation that this is not handled better, but it’s a very frequently asked question. The Looking section of the chapter on Commands covers this.
How do I model a…
As a first resort, check out the “Recipe Book” section of the Index, which lists a lot of common IF objects and situations and gives examples of how to solve them. If that fails, you may also want to look at the Inform 7 extensions page, which contains a bunch of downloadable libraries that you could easily plug in and use. If that doesn’t cover your needs, you could ask for coding suggestions from the rec.arts.int-fiction newsgroup.
How do I change room descriptions, make a room appear differently the first time it’s entered, change the way a list of objects is presented, or hide objects in a room?
There are lots of ways; see my Advanced Room Descriptions page for some discussion of this problem.
You can also replace Inform 7’s existing room description system with one provided by my extension Room Description Control. This gives the author a lot of more-detailed control over the way room descriptions work, but may be overkill for most applications.
What’s the best way to code a non-player character for conversation?
That really depends on the kind of game you’re writing and the kind of interaction you have in mind. The Recipe Book provides a bunch of options exactly because there isn’t a single best answer.
How do I pause the game, wait for a keystroke, change the color of the screen or letters, or make major changes to the status line?
Several extensions come included with Inform to help with these sorts of things. To find out how to use them, look in the Installed Extensions section and then read their individual documentation. Basic Screen Effects and Glulx Text Effects handle many kinds of lettering issues; the Unicode extensions provide support for a wide range of glyphs; Punctuation Removal and Case Management do small but sometimes useful tasks with the player’s input and game output. There is also a menu system and a sample help menu extension to go with it, if you want to offer your player a menu of instructions for playing IF.
How do I erase text that has already been printed to the screen?
Sorry, you can’t do this selectively. You can use Basic Screen Effects to clear an entire window, but you can’t remove just a word or paragraph at will.
How can I create a dispenser that gives out a large number of identical objects? Does Inform support dynamic object creation?
Inform does not currently support dynamic object creation, for reasons to do with the structure of the z-machine. You can, however, create a large stash of identical objects and move them into play. See the example Snip for one case of how to do this.
What’s the best way to make an object that the player can’t see or refer to until he’s examined something else in a room?
Create the object off-stage — that is, don’t give it a location at all. Then move it to the location when the player first examines what he’s supposed to examine.
Permissions and Licensing
Can I use code from the Manual examples in my own game?
Absolutely. That’s what it is there for. Feel free to copy and adapt as you like.
Can I use extensions in commercial works?
Yes. They’re listed under a Creative Commons attribution license, which is the least restrictive license Creative Commons offers; this means that you are only required to credit their authors. See the Creative Commons page for more on these.
Why isn’t Inform 7 open-source? Is the source going to be released? When?
This is discussed somewhat in the January ‘07 thread about where Inform is going.
My biggest gripe with I7 so far is: why in heaven’s sake is the “under” preposition not implemented as part of the builtin library? To implement a cheap “a dollar bill is under the bed” puzzle requires you to open the recipe and copy the moderately large set of relation and verb definitions that implement said preposition. And it is useful and desirable, such that it is in the recipe list, and yet is not builtin. Was it a conscious attempt at trying to suppress said cheap “underneath puzzles” from Inform fiction?
Perhaps I’m just nitpicking, after all, I7 provides such an amazingly rich and natural environment to create IFs like nothing before that I feel guilty just for mentioning my small rant… :/
The historical reason is simply that Inform 6 has no “under” preposition. I don’t think there was a conscious plan to suppress “underneath puzzles”. If there were a groundswell of people writing in to say that they really wish there were a built-in “under” relation, I suspect Graham would consider it. I can’t tell you what he’d actually decide.
Failing that, — well, I’m not sure I’m convinced that copying the example over one time is a horrible amount of work (especially relative to how much work one has to do writing a new game overall). But if the problem is that you don’t like having to do this in multiple works, or you think that the source code for “underneath” clutters your WIP, you could always package this off as an extension and include it wherever you like.
“It’s in the recipe book” isn’t a sign that something should be in the built-in library, though — some of the recipe book things are quite esoteric, or have implementations that conflict with one another: I’m thinking of the numerous different ways to implement things like liquids or conversation.