WelcomeWhat's NewsORLibraryDownloadsLinksWebMaster@OnyxRing.com

This site
produced
656719
pageviews since
8/19/2004

Today's date:
11/20/2017






Author: Roger Firth
Title: Using TextPad with Inform

Creation Date: 8/6/2004 10:38:26 PM
Last Updated: 8/6/2004 10:38:26 PM


Using TextPad with Inform

TextPad is a splendid text editor for Windows: powerful, packed full of useful features, and still easy to use. It's available as a shareware download from www.textpad.com. While there, also visit www.textpad.com/add-ons/ to download txplink4.zip (which fixes Windows so that attempts to call the much inferior NotePad simply fire up TextPad instead), and www.textpad.com/add-ons/hmsyn.html to fetch inform2.zip.

Once you've downloaded those files, do this:

  1. run the downloaded tpengNNN.exe and follow its install process,
  2. unzip inform2.zip, placing the resulting inform2.syn in the TextPad\Samples folder, and
  3. unzip txplink4.zip and follow the setup instructions therein.

Even if you do nothing else, you've got yourself a crackin' good editor. However, it's very straightforward to teach TextPad some tricks which will greatly enhance your Inform productivity.

Creating a TextPad document class

A document class is a family of files having the same extension: for Inform, that's .INF. Follow these steps:

  1. Start TextPad.
  2. From the menu bar, select Configure > New document class... to display the Document Class Wizard.
  3. Enter a class name of Inform, and then click Next.
  4. Enter a class membership of *.INF, and then click Next.
  5. Click to enable syntax highlighting, select Inform2.syn from the dropdown list, and then click Next.
  6. Click Finish.
  7. Select Configure > Preferences..., click to open the list of Document Classes, and click to open Inform. Specify how you want your game files to appear.
  8. Click OK.

Now, any Inform source file that you edit will automatically use syntax highlighting and the other display preferences that you've set. Easy!

Running the compiler within TextPad

Here's how to configure TextPad so that a single keystroke automatically compiles the file that you're editing. Follow these steps:

  1. Start TextPad.
  2. From the menu bar, select Configure > Preferences..., and click Tools.
  3. From the dropdown Add list, select Program.
  4. In the Select File dialog, navigate to the folder containing infrmw32.exe, select it, and then click Open.
  5. In the Preferences dialog, click Apply.
  6. Click to open the list of Tools, and click Infrmw32.
  7. Change the Parameters to (for example) +include_path=.\,.\Library,..\Library $File. This tells the compiler to look for Included files in the current folder, then in a Library sub-folder, and finally in a Library folder alongside the current folder. Change these settings to suit your personal preference.
  8. Glulx only: You may also need one other change to get error message handling to work properly; see the note below.
  9. Click OK.

If you select Tools from the menu bar, you'll see Infrmw32 has appeared as the last item, with a keyboard shortcut of Ctrl+1. Try it: open an Inform file in TextPad, hold down the Ctrl key, and press 1. If you're lucky, you'll see "Tool completed successfully". More likely, you'll get some compiler error messages. Double-click on one of those messages to jump straight to the appropriate line in your Inform file.

Running the interpreter within TextPad

Use exactly the same process so that a single keystroke runs the interpreter. Follow these steps:

  1. Start TextPad.
  2. From the menu bar, select Configure > Preferences..., and click Tools.
  3. From the dropdown Add list, select Program.
  4. In the Select File dialog, navigate to the folder containing WinFrotz.exe, select it, and then click Open.
  5. In the Preferences dialog, click Apply.
  6. Click to open the list of Tools, and click WinFrotz.
  7. Change the Parameters to $BaseName.Z5.
  8. Click OK.

Now, if you select Tools from the menu bar, you'll see WinFrotz with a keyboard shortcut of Ctrl+2. Try it: open a valid Inform file in TextPad, compile it (Ctrl+1) close the "Success" window and then press Ctrl+2 to open it in the interpreter.

The instructions here set up TextPad to compile and run a Version 5 game. Using exactly the same processes, you could also configure Ctrl+2,3 to handle Version 8 games, and Ctrl+5,6 for Glulx. These are left as exercises for the reader.

If you wish to change the Ctrl+1 and Ctrl+2 keyboard shortcuts, follow these steps:

  1. Start TextPad.
  2. From the menu bar, select Configure > Preferences..., and click Keyboard.
  3. From the Categories list, click Tools.
  4. Select the command and the current keys, use Remove and Assign to set a new shortcut.
  5. Click OK.

Note on Glulx error messages

(I'm indebted to Petar Kanuritch for this information.) The Inform and Glulx compilers can output their compilation results in three different styles:

  • -E0: Archimedes-style error messages
    (for example: line 427: Error: No such constant as "top_object")
  • -E1: Microsoft-style error messages
    (for example: C:\Glulx\libg610\Balances.inf(427): Error: No such constant as "top_object")
  • -E2: Macintosh MPW-style error messages
    (for example: File "C:\Glulx\libg610\Balances.inf"; Line 427 # Error: No such constant as "top_object")

where -En is the switch which sets the related style of error message. For each one, TextPad requires a different Regular Expression to match the output and enable a jump to the correct line. These are:

  • -E0 setting
    ^line \([0-9]+\):
    File=
    Line=1
    Column=
  • -E1 setting
    ^\([^(]+\)(\([0-9]+\)):
    File=1
    Line=2
    Column=
  • -E2 setting
    ^File "\([^(]+\)"; Line \([0-9]+\)
    File=1
    Line=2
    Column=

The default entered by TextPad in the "Regular Expression to match output:" box is, happily, exactly the -E1 setting; even better, Inform defaults to -E1 style on a PC, so it all works nicely without further ado. However, Glulx defaults to -E0, so either (a) change TextPad's regular expression to the -E0 setting, or (b) include -E1 in TextPad's setting for Parameters.




Copyright 2004 - 2017 : Roger Firth
OnyxRing.com has been given the potentially non-exclusive right to display the content of this article. However the original author retains all rights. Permission to reproduce this article -- either in part or in whole -- is left strictly to the discretion of the original author.

Table of ContentsAuthorsSearchIndex
Would you
recommend this
article to
someone else?
You bet I would! Heck No!