Roger Firth's IF pages


InfLight -- Inform debugging

Back up

You're going to need four things:

To start with, put all of these files in the same directory or folder. See Graham's Inform Downloads page or Jonadab's list if you've not yet got the library plus a compiler and interpreter for your machine.

On a PC

(Sorry -- this bit is PC-specific; I'm sure it's much easier on a Mac.) The PC compiler isn't a Windows application, which means that double-clicking its icon EXE icon in Windows Explorer doesn't do anything useful. So you can either use MS-DOS Prompt to open an MS-DOS window and type the compilation commands there, or (my recommendation) use a batch file with an icon which you can double-click. Using a text editor, create a file named after the game you're compiling -- in this example CLOAK.BAT -- which contains a single line:

infrmw32 Cloak | more

Now, simply double-click on the CLOAK.BAT icon BAT icon to compile the game and display any compiler messages in a window. (Apparently, this works only under Windows 9*; on NT and beyond you don't see the messages unless you invoke the batch file from the command prompt -- bummer.)

  Compilation window

The word "Finished" in the window's title bar tells you that the compilation is complete; fix any errors or warnings that have been reported, then just close the window and retry the compilation. Remember that some trivial syntax errors -- a missing quote, an extra brace -- can trigger a rash of errors as the compiler loses context; if you find such an error, correct it and recompile to see if all the others go away.

An alternative technique is to redirect compiler messages to a file, by changing CLOAK.BAT to look like this (but I generally find it more convenient to display in the window):

infrmw32 Cloak >Cloak.txt

Yet another possibility: if you're using an Integrated Development Environment (IDE), chances are you'll be able to edit, compile and view the results through a single interface. Even if you're not, some editors provide much the same capabilities. For example, TextPad is easily configured to run the INFRMW32.EXE compiler against the game file you're currently editing, displaying the compiler's messages in a second editor window. Double-click on an error message... and the editor takes you straight to that line in the game file. And you can download a configuration file to apply syntax colouring to Inform games: I highly recommend this editor.

Library location

Your game will Include a number of library files -- PARSER.H, VERBLIB.H and GRAMMAR.H as a minimum, plus any optional packages like OBJLSTR.H which you may be using. By default, the compiler expects to find these in the same directory as the source file; you can reduce clutter and duplication by holding them in one or more standard locations, but you then need to tell the compiler where to look. The following syntax instructs the compiler to look for Included files (a) in the game's directory, then (b) in a Library sub-directory below that, and finally (c) in a Library directory alongside the game's directory. You can easily modify this search pattern to suit your own needs:

infrmw32 +.\,.\Library,..\Library Cloak | more

Compiler switches

You can control various aspects of the way that your game is compiled by using compiler switches (which are nothing to do with the Inform language's switch statement or the library's switchable attribute). For example, the s switch -- they're all one or two characters long -- causes the compiler to display a host of statistics about the game, occasionally useful for checking that you're not about to exceed a Z-machine limit. There are three ways to set a switch; on the compiler command line:

infrmw32 -s Cloak | more

or secondly in an Inform Command Language file, for example CLOAK.ICL:


which you mention in parentheses on the command line:

infrmw32 (CLOAK.ICL) Cloak | more

or finally at the very head of the game itself:

! ============================================================================ !
!   Cloak of Darkness - a simple demonstration of Interactive Fiction
!       This version for INFORM written by Roger Firth on 12Sep99
! ============================================================================ !

Switches  s;
Constant Story      "Cloak of Darkness";
Constant Headline   "^A basic IF demonstration.^";

In this instance, all methods produce the same effect:

  compilation statistics

Note that on the command-line or in an ICL file, you use a minus sign to introduce the switch; if you have several you can give them separately -s -z -v8 or run them together -szv8. At the head of the game, you don't use a minus sign, and if you have several switches you must run them together Switches szv8;. However, since several of the switches seem not to work properly at the head of the game, it's probably better to avoid this method.

Now that we know how to set them, the next segment describes some of the more useful switches.