Adventure Book

version 1/110101 by Edward Griffiths

  • Home page
  • Beginning
  • Previous
  • Next



  • Section: Magic Words

    Magic words are another way to allow the player to make a choice that hasn't been explicitly offered to him. For example, you could set up a computer terminal that requires a password or create a magic word that can be used to defeat an ogre or set up a puzzle that requires the player to deduce the correct sequence of keys to press. For a situation like this, we can create a special command called a magic word.

    To create a magic word, you simply declare it like so:

        Xyzzy is a magic word.

    Now we can make uses for xyzzy.

        A use called IntheHouseA is for In the House. It triggers Teleport to Caves. It uses xyzzy.

    A magic word never needs to be given or removed. (In fact, trying to give or remove a magic word will have no effect.)

    Suppose we want to make a number for the player to enter, like "413". Inform won't allow us to use a purely numeric name for a magic word; "413 is a magic word." will cause an error. In this case, it's probably better to use a sequence that has other characters in it, like "4-1-3" or "4/13". But if it's absolutely necessary, then there is a work-around if you define your magic word like this:

        413 x is a magic word.

    The name "413 x" is a tricky way to declare a magic word that can be referred to as "413". (Technically, "x" will also refer to it, but the system will override it in favor of the restart command.)

    Now we can make a use like this:

        A use called IntheVault is for In the Vault. It triggers Open the Vault. It uses 413 x.

    A word of caution: when using purely numeric sequences for magic words, they will always override the choices that the player types in, even on pages that don't use that magic word. For example, if we decide that the number 1 is going to be a magic word, like so:

        1 x is a magic word.

    then the player will never be allowed to select option number 1 on any page. (And, as a consequence, will never be able to leave the Introduction Screen.) In general, it's best to look for alternatives to purely numeric sequences.