Adventure Book

version 1/110101 by Edward Griffiths

  • Home page
  • Beginning
  • Previous
  • Next



  • Section 5 -- The New Parser

    [We only want the system to recognize, in order: one of the special commands, one of the listed options on the page, a declared inventory item, or a declared magic word. Any other misunderstandings should be treated as inventory items the player doesn't have, which may or may not exist.]
        
    After reading a command:
        repeat through the Table of Commands:
            if the player's command matches the topic entry, make no decision;
        if the player's command matches "[a number]", make no decision;
        if the player's command matches "[any inventory item]", make no decision;
        say "You don't have that.";
        reject the player's command.
        
    Rule for printing a parser error:
        say "You don't have that." instead.