Thursday, June 05, 2008

[I7] Finding your Inform 7 / Simple Chat bug

I just spent a lot of time finding out where a certain bug in my Inform 7 program came from, and I'd thought I'd post it online so people who do the same thing wrong as I can more easily find a solution.

Here's the deal:

If you have an "Instead of doing anything except ..." rule in your code which is active at the beginning of play, and you are using the Simple Chat extension, the result will be that none of your conversation options ever show up in the game. Not even when the "Instead ..." rule is turned off by the time you start a conversation.

The reason for this is that Simple Chat initialises your conversations at the beginning of the game, using the "preparing" action. If you have implicitly disallowed that action, by not putting it in your "except" clause, this initialisation will fail, and no nodes will ever be visible.

The solution is to rewrite your rule as "Instead of doing anything except preparing, ...".

(But I am a bit worried now about using this kind of rule, since it doesn't just stop actions initiated by the player, but also who knows what hidden actions occuring in the background.)

3 comments:

(But I am a bit worried now about using this kind of rule, since it doesn't just stop actions initiated by the player, but also who knows what hidden actions occuring in the background.)

Inform by default doesn't do "hidden actions occurring in the background": actions in the standard rules are all things triggered by the player directly or indirectly. (An implicit take would be indirect -- since it's generated in response to another action. But the player knows that it is happening, and it results from the player's command.)

What makes this case weird is that Simple Chat uses an action (rather than an activity or a rulebook) to handle what is a behind-the-scenes bit of coding. This is a bit eccentric.

Note that 5T18 has an additional bug relating to "doing anything except" that large works may need to compensate for. Vaporware and I both have workarounds (his in I6 to the library, mine in I7 as an in-application workaround) on the newsgroups.