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 April 2011.)

PLEASE NOTE: This is not a good place to comment with specific coding questions, bug reports, or suggestions for future development. If you want to talk about those things, please go on through to the linked forum.


Learning

Is there a full description of syntax for this language? Or: is there a BNF document for Inform 7?

Yes. See the syntax list.

Where should I ask questions about my Inform 7 coding problems?

Many people provide support on the intfiction forum and on ifMUD. Please don’t email them to me or to Graham: we are unable to keep up with such material.

Are there complete games whose source code I could look at?

Sure. See the Worked Examples page on the Inform 7 website, as well as the selection of games on IFDB with Inform 7 source available.

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 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?

Yes: there are now French, Italian, German, and Spanish language extensions available, and other language extensions could be created based on the same model.


Presentation

Can I7 games be set up to be played over a web browser?

Yes. See here for more details.

Can I7 games be played on handheld devices?

Yes. There are a number of custom Z-machine interpreters for handhelds; see the ifwiki page on interpreters. CellarDoor for PalmOS seems to receive especially rave reviews. CellarDoor also handles Glulx games.

What about the iPhone or iPad?

A version of Frotz is available for iPhones and iPads. It comes bundled with a bunch of IF, and it is also possible to move onto it new games from IFDB. Recent versions can play Glulx games and show at least some graphics, though this functionality is new and may be fragile.

Can I7 games be bundled with executables so the player just has to click to play?

For some platforms. I don’t 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.)?

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, and there are extensions to help access this functionality. 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?

Yes. See Guncho, as detailed in 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 be used to write graphical adventures?

Maybe, in a totally painful way: using the GLIMMR extensions, it would be possible to layer sprites in a visual environment in a Glulx window, while suppressing the parser and directing input through mouse clicks. But why in the world would you want to do this? I7 is designed for a different domain; while it does have some multimedia abilities, it’s really not ideally adapted for graphical input and output. If that’s what you want to write, I recommend looking into something like Ren’Py (for visual novels) or SLUDGE (for full-on graphical adventure games). Both of those skip over all the parser business that I7 spends so much time on, but do provide extensive facilities for placing and handling images.

Could Inform 7 games be displayed with an alternative interface, say in Flash?

Not easily in Flash itself, but there’s some progress towards prototypes that would allow for substantially different front ends.

David Cornelson’s Textfyre company has created its own Glulx interpreter with a different approach to I/O, some version of which is likely to be made available for non-commercial use by the IF community. Information on FyreVM is available here: it would allow a Glulx game to be combined with UI components in Flash or other programming platforms.

You may also be interested in the (unfinished, not yet usable) Vorple project.

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 Ron Newcomb’s library messages extensions on the extensions page.

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.

See the activities pertaining to printing the description of a locale.

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 the “Looking” section of the Recipe Book for a detailed breakdown of the 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.

In the future, javascript front-ends such as Vorple may provide this functionality for games played in a browser window.

How can I create a dispenser that gives out a large number of identical objects? Does Inform support dynamic object creation?

Inform does not by default 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 Recipe Book section on “Dispensers and Supplies of Small Objects” in the Physics chapter.

In Glulx, you have another option: Jesse McGrew’s Dynamic Objects extension, available from the extensions page. See the extension documentation for details.

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.

24 thoughts on “Inform 7 FAQ

  1. 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… :/

  2. 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.

  3. Hey there, I been asking around the communities this, but I have a question… How do I compile my I7 story file into .z3 instead of 5?

  4. Hey Emily, I just purchased a Dell Axim X51v, a PDA which has a more powerful processor than my very old home computer. I’m running Inform 7 on my PC, and I was wondering if a port to Windows Mobile would be possible…

    I shouldn’t think it would be all that hard, as Windows Mobile is a very similar platform. What do you think?

  5. I have no idea, honestly — you’d probably want to check with David Kinder who does the Windows application.

    Trying to program IF on a tiny PDA keyboard sounds to me like an excruciating experience, but possibly I am imagining incorrectly.

  6. I’d love to see a way to erase text already on screen. I picture a scene that takes place on entirely one page, where the relevant general information, the establishing sentences, is always written on screen, and the more specific action is erased and replaced as needed. Is this something that could be accomplished with an extension, or is the limitation somewhere deeper under the hood?

  7. Much deeper, I’m afraid. You could get some of that effect using Glulx and multiple windows: put the establishing text in one place, put the other stuff in a different window, wipe the secondary window periodically as needed. But it’s hard to get much finer-grained than that.

    Alternatively, you might be interested in Dave Cornelson’s FyreVM, which involves some alternate ways of presenting information output from a Glulx game. It is sort of a work in progress, but it has an idea of “channels”, which you can use to pass information to the interpreter to be shown to the player however the interpreter deems appropriate. That might involve printing some game text to a different window, displaying time status as a clock face, making score info give you some kind of progress bar, etc.

    But with the standard Z-Machine, erasing anything you’ve already printed is pretty well out of the question. It doesn’t keep track of what the screen looks like once something is printed to it, so there’s no way to say “hey, okay, go take that bit back…”.

  8. My son is using Inform 7 at school on e-Macs and we downloaded I7 at home on our 2006 Intel I-Mac. When he brings a saved file home to work on he opens the file and there is no source text in the window. Do you know how to solve this or questions we should ask?

    Thanks,
    Brian

  9. That’s great that he uses Inform 7. Does the school work it into the curriculum? That sounds pretty interesting.

    I don’t know if this will work on your computer, but on windows, but you may want to open the folder “source” within the project’s folder, then make a copy of the story file. On my computer, this file has a “apples.ni” extension. If opening that doesn’t work, then try renaming the copy to “apples.html”, then open the .html file with safari, or a web browser.

    Hope this helps.

  10. A comment that a friend made when I showed him Inform 7 and some of its criticisms–

    “I guess the language needs a robust way to define new words and grammatical constructs, so that whenever someone runs across a word the compiler doesn’t understand, they write translational code for it (probably in a different language). If it were made open-source and real-time updatable (or something close), that kind of language could grow into a natural-language language. Assuming people don’t screw up the programming, that is.”

    Being utterly ignorant of programming, I have no idea how feasible this is; just something to divert you if you find a lull in your day…

  11. I wrote a game, and the first time I compiled it, it was successful. But the second time, it didn’t work… I didn’t change anything, butI got a lot of error messages that I didn’t get before. What’s going on and how can I fix it?

    • That’s way too little information for me to diagnose from, I’m afraid. I suggest posting a fuller description of what happened to the intfiction forum here: http://www.intfiction.org/forum/viewforum.php?f=7

      By fuller description, I mean details like: did you upgrade versions of Inform between compilations? did you move files around? what operating system are you using? what are the errors that you got? if the game is short enough for you to post the source code, what is it?

  12. I am having trouble with giving two discriptions of things. for example, I wrote: The discription of the chair is “A worn leather backed chair.”
    But a error message pops up saying:
    Problem. You wrote ‘The discription of the chair is “A worn leather backed chair.”‘  
    : but this seems to say that a thing is a value, like saying ‘the chair is 10′.

    Why is it doing this?

    • Inform doesn’t know about a “discription” of an item, because that’s a misspelling; you need “description”. So it thinks “discription of a chair” is a new object you’re defining, and then you’re making that equal to some text — which doesn’t make sense.

      However: commenting here is not a good way to get general I7 advice. A better place is the intfiction forum, which is read and answered by a larger group of people. You can find it here:

      http://www.intfiction.org/forum/index.php

  13. Thanks for FAQ. It covers many aspects that I couldn’t get known anywhere else.
    I think Inform 7 has large potential. Before it the only source of interactive books for me was DreamPath, but HTML books have many limitations.
    The only thing I want to complain about built-in library is that there are no phrase for list of exits.
    One personal question: what part of “Writing with Inform” and “Inform Recipe Book” you have done?

    • If you check out the extensions page, you’ll find several flavors of exit lister available.

      I wrote almost all of the examples themselves, and the bulk of the text in the “Recipe Book.” Graham Nelson wrote the bulk of the text in “Writing with Inform.”

  14. Well, this isn’t a rank or a cry for help or anything. It’s a plain old “I have a tear in my eye” message:

    When in child form, I spent numerous hours playing Fighting Fantasy books and loved them. A few months ago I offered one to a cousin and nostalgia broke up. I thought to myself that when I was a kid I also played one or six text adventure games, so I decided to search for those (thought I, in ignorance) old approaches to gamming and replay them. To my surprise the genre was alive and well, with a surprisingly large community and offering quality products. I searched for games with good ratings: found yours, found others (the one choice marble called Aisle; the “hey! i’m really that guy!” wonder called Violet; Blue Lacuna, of course; etc) – and a strong will to do my own erupted: after all I’ve always loved computer games and literature.

    Few years ago I’ve learned very basic perl language, so I thought I could give IF languages a try. The first one I tried was Inform 7 – and the natural approach instantly went to bed with me, put a ring on my finger and called a priest.

    But now for the main issue: I’m not the most modest of persons, so I don’t have a problem in going on record saying I consider myself a good (maybe well above average) writer – in portuguese! But there are no IF players in Portugal; well, there may be a few, but not a community, and the few that do exist must be playing IF in english anyway. But I don’t write in english the way I write in portuguese, so I won’t be able to wordle myself those nice phrases I get when writing… errr… naturally. Me have to learn better english write; me have to learn verbs and things like verbs; me have many work to do other then programming things.

    Well, anyway, I’m givin it a try and I’ll probably seek help in this little corner of yours often. It taught me so much so far.

    Thank you!

    • Hey Leandro – you are not the only IF fan in Portugal :) and I was also a massive Fighting Fantasy fan back in the day. i have never seen any Portuguese IF – have you made one yet?

  15. How do I make the player see the inventory of the person when he examines that person? And is there a site designed for sharing sources and tips?

    Thanks for your time.

    • How do I make the player see the inventory of the person when he examines that person?

      Try something like

      After examining someone:
      if the noun carries something:
      say “[The noun] has [a list of things carried by the noun].”

      And is there a site designed for sharing sources and tips?

      The best place for this right now is the intfiction forum.

  16. Problem 1: I try examining Grimace, but the game quits for no reason. I also tried giving things to him, but the game quits too.

    Source code:
    Cave is west of the mountain path. “This is a small natural cave. It seems to be a dwelling place of some kind. Small chairs and tables are crammed into the cave, and a small lamp hangs from the ceiling.”

    A dwarf is a kind of person.

    grimace is a dwarf in the cave. The description of grimace is “A short stout looking dwarf.”

    Grimace is carrying a energy cake and the crossbow. The description of the energy cake is “A small cake with special herbs mixed into it.” Understand “[cake]” as energy cake. The energy cake is edible

    Problem 2:
    The after going west rule does not happen on the beach, but happens in the bank for some reason. And the gate doesn’t shut after the player goes west on the beach.

    Source:
    The beach is north of mountain path. “A sandy beach. Waves crash on the rocks, bringing the smell of salt. A chilly wind blows off of the coast, making you shiver. To the north, is the ocean, and to the east, is a small building. A golden gate to the west leads into the fortress of the troll king.”

    Instead of going north in the beach, say “You don’t feel like swimming right now.”

    After going west in the beach:
    Now the golden gate is closed;
    Now the golden gate is locked;
    say “As you pass through the gate, it swings close behind you.”

    Bank is east of the beach. “This is a small bank for trolls. It’s not much. Some tables, some chairs, and a huge box for depositing your goods.”

    The golden gate is a door. The golden gate is west of the beach. The golden gate is closed and locked. The description of the golden gate is “A golden gate that leads to the fortress. A small lever is fixed onto it.”
    The lever is part of the golden gate.
    Instead of pulling the lever:
    Now the golden gate is open;
    say “With a grinding noise, the gate opens.”

Comments are closed.