Inform 7 allows arithmetic to be carried out in respect of integer numbers only.  By way of an experiment (and for the sheer joy of creating something) I have written an extension to permit fixed point maths.  It is still in beta form and can be tested on the following link:

Some words of warning:

  • I am a lawyer and priest by training, not a mathematician or computer programmer so some of the functions may need refining.  Most of the functions are calculated using brute force and ignorance.
  • Error checking routines have not yet been added so things like division by 0, overflows, underflows and square roots of negative numbers have not been trapped.
  • The extension requires the use of Glulx.
  • It is set up for four decimal places.  This can be changed but it requires editing the extension.  Only numbers in the range -214748.3648 to 214748.3647 are supported.
  • Documentation has to be added.

Jeff Nyman has written an excellent guide on how rules are used within Inform 7.  You can view it here.

Good.  Then I’ll begin.

Having sucessfully created a way of allowing the player to “insert x” without having to specify into what x should be inserted, I thought I would try to do something similar if the player types “sit” and there is only one chair in the location.

This was not as easy as the “insert x” example.  Understand “sit” as sitting does not work.  A quick look at the actions index showed me why.  Sit is used as a synonym for the entering action.  Although I could have understand “sit” as entering, it seemed to me that this was starting to strain the English language.

I therefore decided to create a new action for sitting.  To being with, I needed to break the link between sitting and entering and create a new action for sitting.

Understand the command “sit” as something new.
Sitting is an action with past participle sat, applying to one touchable thing.
Understand “sit on top of [something] as sitting.
Understand “sit on/in/inside [something] as sitting.
Understand “sit” as sitting.

This creates the framework for the new sitting action.

Next I needed to provide a rule for supplying a missing noun so that the command “sit” on its own would work.

Rule for supplying a missing noun when sitting (this is the find something to sit on rule):
let count be the number of enterable supporters in the location;
if count is 0:
  say “There is nothing here to sit on.” instead;
if count is greater than 1:
  say “You will need to specify what you want to sit on.” instead;
if count is 1:
  let target be a random enterable supporter in the location;
  change the noun to the target;
  say “(on [the target])”.

This creates the correct framework but as yet, the sitting action does not do anything.  To create a meaningful action I needed to add “check”, “carry out” and “report” rules to govern the action.  To do this, I used the pattern of the “check”, “carry out” and “report” rules for the entering action.

Check an actor sitting (this is the can’t sit on something twice rule):
 if the actor is on the noun:
  if the actor is the player:
   say “You are already sitting on [the noun].” instead;
   say “[The actor] is already sitting on [the noun].” instead.

Check an actor sitting (this is the sit on non-supporters rule):
 if the noun is not an enterable supporter:
  say “It isn’t possible to sit on [the noun].” instead.

Check an actor sitting (this is the can’t sit on something carried rule):
 if the holder of the noun is a person:
  say “It isn’t possible to sit on [the noun] whilst it is being carried.” instead.

Carry out an actor sitting (this is the standard sitting rule):
 surreptitiously move the actor to the noun.

Report an actor sitting (this is the standard report sitting rule):
 if the actor is the player:
  say “You sit on [the noun].”;
  say “[The actor] sits on [the noun].”

And voila, a new action to allow the player to sit on things with a simple “sit” command allowing a short-cut where there is only one chair in the room.

The player is standing in front of a slot machine and types the command “insert coin”.  The games responds with “what do you want to insert the coin into” (or words to that effect).

I had a similar situation in my code.  Looking the the Inform 7 manual, it looked like I needed to add some code using the “rule for supplying a missing second noun when inserting”.  I duly added the rule and lo and behold it did not work.  Fiddlesticks, I said, or words to that effect.  Much head scratching later, it transpires that not only did I need to add the “missing second noun” rule, I also need to create a new “understand” token.

The new code now allows the player to short cut inserting items into things by simply typing “Insert thing”.


Understand “Insert [something]” as inserting it into.

Rule for supplying a missing second noun when inserting:

let count be the number of open containers in the location;

If count is 0:

say “There is nothing to insert [the noun] into here.” instead;

if count is 1:

change the second noun to a random open container in the location;

if count is greater than 1:

say “You will need to specify what you want to insert [the noun] into.” instead.



With nothing much to do on a wet and windy Bank Holiday Monday (why does it always rain on bank holidays?), my wife suggested that it would be a good idea to clean out some cupboards and drawers.  With the kids engrossed in front of the TV we spent a couple of hours sorting out, throwing away, rearranging and tidying up.  The result was lots more space, the ability to find things and a bag or two of rubbish.

This bout of spring cleaning triggered the thought in my mind that my Inform 7 code needed a similar approach.  I am now going through it top to bottom and reviewing and trimming it.  It is amazing what is in there that is redundant, needs tidying up and sorting into a logical order.  I am also using the opportunity to add rule names (really helpful when debugging) and using the new Pythonesque code indentation for conditions and loops.  I did not think that I would like this but having used it several times now, I much prefer the structure.

Another benefit of the review is that I am spotting things that need to be corrected or supplemented.  One section of the code allows the player to look under something to find things that are hidden.  The code works but it was indiscriminate.  Elsewhere in the game, I have a backdrop called the sky.  Typing “look under the sky” produced the response “You find nothing of interest.”  A similar response was received if the player looked under the floor (not an everyday thing that you do unless armed with a pick-axe).

All I need now is a few more wet weekends to encourage me to continue the code clear out!

I got back to my work in progress and tackled one of those minor niggles that was waiting on the back burner to be dealt with.  A new action worked, but not quite as I wanted.  It needed a little bit of finessing to remove some rough edges and I needed to experiment with various options to get the right result.

One of the things about Inform 7 is the integrated IDE.  You write your code in the source pane, compile and can immediately play in the other pane.  Any problems are highlighted and (usually) it does not take long to change any offending lines any try again.  Five or six attempts later, I think I have the problem sorted.  I will return to it again in a few days time.  Often today’s solution looks half baked later in the week.  We shall see.

The Interactive Fiction forum “RAIF” is a wonderful place to learn about interactive fiction in general and about Inform 7.  As a rookie, I tend to read more than I contribute.  The only problem is that I easily get sidetracked and spend more time looking at examples and questions there than I do creating my first game.  So today, I plan to spend more time on the game and less time on RAIF (famous last words).

David Kinder has done a magnificent job with the Windows version of Inform 7.  It is work in progress and new features are added with each release of Inform 7.

You can change the font, font size and tab spacing but to do so, you have to edit registry settings.  The settings to use are:

Registry string value “HKCU\Software\David Kinder\Inform\Window\Font Name”

Registry DWORD value “HKCU\Software\David Kinder\Inform\Window\Font Size”

Registry DWORD value “HKCU\Software\David Kinder\Inform\Window\Source Tab Size” (the default value is 36.  I find that halving this to 18 gives an acceptable tab indent when editing Inform 7 code.

These values have to be added manually to the Windows registry.  As always, take care when editing the registry as you can render your machine unusable.


I am setting sail on the blogging sea.  This will be mainly random musings about Inform 7, an insanely wonderful piece of software for writing and publishing Interactive Fiction.