Adventure Book

version 1/110101 by Edward Griffiths

  • Home page
  • Beginning
  • Previous
  • Next

  • Chapter: Integrating Inform 7 Code

    Section: Relationships

    The purpose of the Adventure Book extension is to provide beginners and non-programmers a relatively simple and flexible way to write interactive fiction. However, experienced Inform 7 users may want to take full advantage of the language to produce more advanced effects. This chapter will detail how the Adventure Book system works behind the scenes and give authors some basic guidelines for using Inform 7 code to change or extend Adventure Book's behavior.

    The Adventure Book system is built on three core kinds of things: pages, choices, and flags. A use is a kind of choice, an inventory item is a kind of flag, and a magic word is a kind of inventory item. The meat of an adventure book program is describing the properties of these objects and their relationships with each other.

    Here is a comprehensive list of all of the relationships defined by Adventure Book:

        Offering relates one page (called the parent) to various choices. The verb to offer (it offers, they offer, it offered, it is offered, it is offering) implies the offering relation. The verb to be for implies the reversed offering relation.
        Triggering relates various choices to one page (called the destination). The verb to trigger (it triggers, they trigger, it triggered, it is triggered, it is triggering) implies the triggering relation.
        Following relates one page (called the destination) to various pages. The verb to follow (it follows, they follow, it followed, it is followed, it is following) implies the following relation.
        Adding relates various pages to various flags. The verb to give (it gives, they give, it gave, it is given, it is giving) implies the adding relation.
        Clearing relates various pages to various flags. The verb to remove (it removes, they remove, it removed, it is removed, it is removing) implies the clearing relation.
        Requiring relates various choices to various flags. The verb to require (it requires, they require, it required, it is required, it is requiring) implies the requiring relation.
        Cancelling relates various flags to various choices. The verb to cancel (it cancels, they cancel, it cancelled, it is cancelled, it is cancelling) implies the cancelling relation.
        Using relates various uses to one inventory item (called the tool). The verb to use (it uses, they use, it used, it is used, it is using) implies the using relation.

    You could, if you wished, rewrite the syntax for the game system by defining new verbs for the relationships. For example, if you don't like the expression "It triggers..." and you'd prefer to write "It turnsto..." instead, simply include this line in your program:

        The verb to turnto (it turnsto, they turnto, it turnedto, it is turnedto, it is turningto) implies the triggering relation.

    Now you can write a (grammatically incorrect) sentence like:

        A choice called thefirstpagea is for The First Page. "Go on a hike." It turnsto GoHiking.