Adventure Book

version 1/110101 by Edward Griffiths

  • Home page
  • Beginning
  • Previous
  • Next



  • Section: Choices

    The most important function of an Adventure Book is to offer the player choices. Choices are listed after the quoted text that describes a page. Here is a page with three choices:

        The First Page is a page.
        "You are at the beach. What would you like to do?"
        A choice called TheFirstPageA is for The First Page. "Go for a walk." It triggers Go Walking.
        A choice called TheFirstPageB is for The First Page. "Build a sand castle." It triggers Building a Sandcastle.
        A choice called TheFirstPageC is for The First Page. "Go for a swim." It triggers Go Swimming.

    Creating a choice has at least three parts. First, "A choice called [something] is for [a page]." tells Inform that we are creating a new choice for the page we've named. What we decide to call the choice isn't important because we'll never have to refer to it, but we can't have two choices with the same name. It's a good idea, then, to give a choice a name that refers in some way to the page that it's on to avoid making duplicates.

    The second part is quoted text that's displayed when the page is read. You don't need to include the number that the player types to select the option; the system does that automatically. When the program is run, the page above will be printed like this:

        You are at the beach. What would you like to do?
        
        1) Go for a walk.
        2) Build a sand castle.
        3) Go for a swim.

    The third part tells where the story will go if the player selects this choice. "It triggers Go Walking." means that, if the player selects "Go for a walk.", the program will "turn to" the page with the name Go Walking, and play will continue from there.