Adventure Book

version 1/110101 by Edward Griffiths

  • Home page
  • Beginning
  • Previous
  • Next

  • Section: The Adventure Book Phrasebook

    The following is a list of all phrases defined by Adventure Book and what they do.

        turn to (destination - a page)

    The Adventure Book system uses variables called "current page" and "previous page" to mark the player's place. The phrase "turn to [page name]" is used when we must conclude an author-written command by turning to a new page. It is responsible for updating the current and previous pages, flipping through the book until it reaches a page with a choice, rebuilding the list of choices based on where we ended up and how the game flags look, and giving the player the result. This should NOT be used in a "to run inform code for..." block; use "change pages to..." instead. (See the section on Running Inform Code.)

        set (x - a flag)

    Sets x to the on position. If x is an inventory item, it moves x into the player's possession.

        clear (x - a flag)

    Sets x to the off position. If x is an inventory item, it removes x from the player's possession.

        rebuild the list of choices

    Throws out the old list of choices and creates a new one based on the current state of flag variables and the current page. This should always be done in a command that alters the game's flags without turning to a new page; otherwise, the player may be allowed to select choices that are no longer valid. Also, it's a good idea to end such commands with "try looking" to show the player his new list of choices.

        read (x - a flag)

    Prints the description of the given page and does nothing else.

        read through to the next decision

    This phrase is primarily used by the "turn to..." phrase, and it's responsible for a lot of the messy work of moving from page to page correctly. First, it runs any special inform code that may be defined for the current page. Then, it sets and clears any flags associated with that page. If the current page is followed by another page, it prints the description of the page and moves to the next page, running inform code and manipulating flags until it reaches the end of the chain of "It is followed by..." statements. If the current page is a dead end, it skips back to the page where the player made his last decision WITHOUT running inform code or manipulating flags.

    It won't be necessary to invoke this phrase in most cases; it's usually much more useful to just use "turn to..." instead. However, it is available if necessary -- if, for example, you'd like to write a new "turn to..." phrase.

        decide if (possibility - a choice) is valid

    This is true if the choice is not cancelled by any "on" flags and it does not require any "off" flags, and false otherwise.

        decide if (possibility - a page) is unwritten

    This is false if the page has no means to continue (no choices, no "It is a dead end." statement, no "It is followed by..." statement) and true otherwise.

        change pages to (x - a page)

    This phrase changes the current page to the given page and then runs inform code for it. (See the section on Running Inform Code.)

        run inform code for (x - a page)

    This phrase does nothing unless it has been redefined by the author. (See the section on Running Inform Code.)