Infocom Classic Text Adventure Masterpieces
1936 Edition Dennis Wheatley Crime Dossier

A Few Inform 7 Tips

I'm still a newcomer to Inform 7, the language I'm using to write a murder mystery story.  For those who haven't tried it out, Inform 7 is a fantastically rich environment for developing Interactive Fiction (IF).  But, much like IF itself, there's often an element of "guess the verb" in trying to figure out how to do something.  So here are a few simple discoveries I've made.  I've not broken any new ground here, these are all documented somewhere.  But sometimes the question is where.

  • You want to have scoring, but omit the automatic score messages 
    When play begins: silently try switching score notification off.  
  • You'd like to have some introductory text before the game banner
    When play begins: say "From Hollywood, it's time now for..." 
  • You'd like some text after the game banner, before the first room
    After printing the banner text when not requesting the story file version : say "...Yours truly, Johnny Dollar."  
  • You want to display exits in the status line
    Include Exit Lister by Eric Eve. 
  • You want the status line to display time of day and score
    When play begins: change the right hand status line to "[score] / [time of day]".
    When play begins: now the time of day is 9:41 pm.   
  • You want to give the player some help when they make mistakes
    There's a command called Understand as a mistake which is a great way to give the player some help without having to code a whole lot.  Here are some examples pulled right from the commands Alpha testers tried.
    Understand "consult [something]" as a mistake ("Try CONSULT notebook ABOUT something."). 
    Understand "pour [someone] [text]" as a mistake ("Try POUR liquid INTO glass.").
    Understand "pour a drink" as a mistake ("Try POUR liquid INTO glass.").
    Understand "leave lobby" as a mistake ("You can go EAST or WEST or you can wait for Sgt Duffy.").
    Understand "read notebook about [text]" as a mistake ("Try CONSULT notebook ABOUT something.").
    Understand "talk to [Monica Robner]" as a mistake ("'Johnny, what do you want to ask me or tell me about?'").   
  • At rules shouldn't be used in a condition 
    At rules will always fire, even if they are placed inside a condition.  So if necessary, place the condition inside the At rule.  e.g. 

    [ Message will be displayed at 10:30 regardless. ]
     if the player is not in the Lobby:
        At 10:30 pm: say "Maybe you should go to the Lobby."

    [ This works properly.]
    At 10:30 pm: 
        if the player is not in the Lobby:
           say "Maybe you should go to the Lobby." 
  • Ask / Tell dialog rules don't work the way you think they do 
    It's relatively easy to create simple conversations with Ask / Tell rules like:
    > Ask Monica about Cabeza Plana
    > Tell Monica about accident 

    Unfortunately, Ask / Tell rules only work with generic text "topics" and not with strings that happen to be objects in your game, which is probably what you want most of the time.  Additionally, the text has to match exactly.  So asking about "accident" is different from asking about "the accident". 

    Luckily Jim Aikin in his work The Inform7 Handbook covers all of this.  You need to write an Understand rule to make different terms synonymous.  Aikin also shows how to write new rules called Quizzing and Informing that act like Ask and Tell for objects in the game.  

Admittedly, these are not the most complicated code snippets, but when you're stumped you're stumped.  I found these by searching the Intfiction forum, the forum, the Inform 7 manual and Jim Aiken's and Aaron Reed's excellent books on Inform 7.  If you're just getting started in Inform, I hope these tips will save you some time.


Feed You can follow this conversation by subscribing to the comment feed for this post.

The comments to this entry are closed.