h1

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 November 2009.)


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

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. At time of writing, there are many options, if you’re compiling for the Z-machine. Probably the most actively developed and stable at the moment is Parchment. Jay Is Games has its own, in-house Flash Z-machine, but has not released this for public use; it is only used for games that JIG is hosting.

If you’re compiling to Glulx, you may instead want to look at Zag.

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?

A version of Frotz is available for iPhones. It comes bundled with a bunch of IF, and it is also possible to move onto it new games from IFDB.

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 at least one extension on the extensions page deals with real-time. 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 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 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.

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.

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.

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.

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.

18 comments

  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. How do I compile my I7 story file into .z3 instead of 5?

    To the best of my knowledge, you can’t. Producing .z3 files is, I think, impossible even with recent versions of Inform 6. If you are interested in more discussion on library/compiler sets that *do* support .z3, check out this thread:

    http://groups.google.com/group/rec.arts.int-fiction/browse_frm/thread/ed888304e54346e/e0dff29dad6372e0?lnk=gst&q=z3#e0dff29dad6372e0


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


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


  7. Thanks, Em! How would I contact David Kinder?


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


  9. 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…”.


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


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


  12. 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…


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


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


  15. 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.”



Leave a Comment