Roger Firth's IF pages

Home

InfLight -- Inform debugging

Email
Back up

While the D switch provides a basic set of debug commands, the X switch gives you Infix, a much more powerful debugging environment. With this switch set, you'll see SX displayed in the game's banner, rather than the usual SD.

All Infix commands are introduced by a semicolon ; as their first character (just ; on its own outputs some instructions). If the next character is a space, Infix treats what follows as an expression to be evaluated (we'll come back to that in a minute). Otherwise, Infix recognises these commands: ;EXAMINE, ;GIVE, ;MOVE, ;REMOVE, ;WATCH and ;<.

;EXAMINE or ;X

You can ;EXAMINE many aspects of a game; the nice bit is, you've now got access to the internal names from the program:

 
>;X STORY
; Constant Story == 31179

>;X 31179
; The number 31179 == $79cb

>;X FOYER
Object "Foyer of the Opera House" (24)
  has light visited
  with n_to "You've only just arrived, and besides, the weather outside seems to
       be getting worse." (32105),
       s_to Foyer bar (27),
       w_to Cloakroom (25),
       description "You are standing in a spacious hall, splendidly decorated in
       red and gold, with glittering chandeliers overhead. The entrance from the
       street is to the north, and there are doorways south and west." (32071),

>;X N_TO
; Property n_to (numbered 7)
Provided by: Foyer of the Opera House (24), Foyer bar (27)

>;X LIGHT
; Attribute light (numbered 10)
Each of these "has light": Foyer of the Opera House (24), Cloakroom (25)

Here's some information on verb grammars:

 
>;X 'HANG'
; Dictionary word 'hang' (address 10823): verb
Verb 'hang'
     * held 'on' noun -> PutOn

>;X PUTONSUB
; Routine PutOnSub (number 163, packed address 18710)

>;X ##PUTON
; Action PutOn (numbered 18)
'discard'  * multiexcept 'on' / 'onto' noun -> PutOn
'drop'  * multiexcept 'on' / 'onto' noun -> PutOn
'hang'  * held 'on' noun -> PutOn
'put'  * multiexcept 'on' / 'onto' noun -> PutOn
'throw'  * multiexcept 'on' / 'onto' noun -> PutOn

;GIVE

Use ;GIVE to set and clear object attributes.

 
>;GIVE BAR LIGHT
; give (the Foyer bar) light

>SOUTH

Foyer bar
The bar, much rougher than you'd have guessed after the opulence of the foyer to
the north, is completely empty. There seems to be some sort of message scrawled
in the sawdust on the floor.

;MOVE and ;REMOVE

;MOVE and ;REMOVE also work just like the equivalent program commands; as with ABSTRACT, you can bend your own rules:

 
>DROP CLOAK
This isn't the best place to leave a smart cloak lying around.

>;MOVE CLOAK TO LOCATION
; move (the velvet cloak) to (the Foyer of the Opera House)

>;GIVE CLOAK ~WORN
; give (the velvet cloak) ~worn

>LOOK

Foyer of the Opera House
You are standing in a spacious hall, splendidly decorated in red and gold, with
glittering chandeliers overhead. The entrance from the street is to the north,
and there are doorways south and west.

You can see a velvet cloak here.

>REMOVE CLOAK
; remove (the velvet cloak)

;WATCH or ;W

The ;WATCH command notifies you when something happens to a watched object; you can also watch routines:

 
>;W CLOAK
; Watching object "velvet cloak" (28).

>REMOVE CLOAK
[ "velvet cloak".before() ]
[ cloak.before() ]
[Giving velvet cloak ~worn]
[ "velvet cloak".after() ]
[ cloak.after() ]
You take off the velvet cloak.

>HANG IT ON HOOK
[ "velvet cloak".before() ]
[ cloak.before() ]
[Giving velvet cloak ~general]
[Moving velvet cloak to small brass hook]
[ "velvet cloak".after() ]
[ cloak.after() ]
You put the velvet cloak on the small brass hook.

[Your score has just gone up by one point.]

;<

The last command that we'll mention -- ;< -- invokes an action, even one that would otherwise be intercepted:

 
>DROP CLOAK
This isn't the best place to leave a smart cloak lying around.

>;< DROP CLOAK
; <Drop (the velvet cloak)>
(first taking the velvet cloak off)
You take off the velvet cloak.
Dropped.

Note that in the first line of input, "DROP" is a verb which normally calls the Drop action, but the cloak's before routine prevents this happening. On the second input line, "DROP" is the actual action, which then happens unimpeded.

Expressions

Finally, Infix can evaluate expressions and assign values to certain things.

 
>; INITIALISE
; == 22478

>; INITIALISE()

Hurrying through the rainswept November night, you're glad to see the bright
lights of the Opera House. It's surprising that there aren't more people about
but, hey, what do you expect in a cheap demo game...?

; == 1

>; 'CLOAK'
; == 10193

>; SCORE = SCORE + 1
; == 1

[Your score has just gone up by one point.]

Supposedly, you can also send messages to objects, but so far the syntax for that escapes me.


Next, a quick look at an interpreter which places special emphasis on the debugging process.