Adventure Book

version 1/110101 by Edward Griffiths

  • Home page
  • Beginning
  • Previous
  • Next

  • Section: New Commands

    One way to modify the behavior of the Adventure Book system is to create a new game command. The extension normally overrides most of the player commands that are built into Inform 7, but it doesn't have to. A table called the Table of Commands holds all of the extra commands that Adventure Book recognizes beyond the numbers for selecting choices and the names of inventory items and magic words. You can add new commands to this list by continuing the table like so:

        Table of Commands (continued)
      "examine [an inventory item]"  

    This will allow the player to use the commands "jump" and "examine [something]" in exactly the same way that they're used in Inform 7.

    For example, let's say that we want to allow the "examine" command so that the player can look at his inventory items without having to provide him an explicit choice to do so. We would add "examine" to our Table of Items, and provide descriptions for all of the things the player might carry:

        "A Closer Look" by Edward Griffiths
        Include Adventure Book by Edward Griffiths
        Table of Commands (continued)
      "examine [an inventory item]"  
        The ball is an inventory item. The description is "Round and colorful."
        The pail is an inventory item. The description is "A small sand toy."
        The ruby is an inventory item. The description is "Red and beautiful."
        The First Page is a page.
        "You've got a handful of knickknacks. Type 'examine (item)' to take a closer look."
        It gives the ball, the pail, and the ruby.

    Note that only the word "examine" will be accepted; synonyms like "look at" will have to be rejected unless we specifically list them.

    Most Inform 7 commands aren't designed to function with Adventure Book's world model, so this is more useful for authors who want to add their own custom commands to a game. When a command is carried out, it can print information, adjust flags, and even move the player to a different page, if necessary. See The Adventure Book Phrasebook for the list of phrases that you can use in your commands to change the game state.