Modified Lock-Unlock

version 2 by Al Golden

  • Home page
  • Beginning
  • Previous

  • Example: ** Lock/Unlock Test - a small test program.

        "Lock/Unlock Test"

        Include Modified Lock-Unlock by Al Golden.

        Starter is a room.

        a chestkey is in Starter.
        the chestkey is unlockable.
        the printed name of the chestkey is "chest key".
        understand "key" and "chest key" as the chestkey.
        the chestkey is matched.

        a locked, openable, lockable door called a plain old door
        is north of Starter and south of Ender.

        a locked, openable, lockable thing called a gizmo is in Starter.

        a locked, lockable, openable container called a box is in Starter.

        a locked, openable, lockable thing called a thingy is in the box.

        a locked, openable, lockable key-required container called a chest is in Starter.
        an unlockable unopenable thing called a whizbang is in the chest.

        before opening something with a second noun:
        if the second noun is not the chestkey,
        say "Don't be ridiculous! ! ! !" instead.

        instead of opening the chest with a second noun:
        if the second noun is not the chestkey begin;
        say "The [second noun] isn't used for opening the box.";
        now the chest is open;
        now the chest is unlocked;
        say "You unlock and open [the noun] with [the second noun].";
        end if.

        [Test Scripts]
        test go with "take key/take box/unlock door/open door/n/close door/lock door/unlock door with key/open door/s".

        test open with "open box with door/open box with gizmo/open box with key/open chest/open chest with key/take key/open chest with key".

        test chest with "open chest/unlock chest/take key/unlock chest with key/lock chest with key/unlock chest/lock chest/drop key"

        test unlock with "unlock box with box/unlock box with gizmo/unlock key with key/unlock key/unlock gizmo with gizmo/unlock chest with key/take key/unlock chest with key/open chest/unlock box/unlock gizmo/unlock thingy/unlock door".

        test lock with "lock box with box/lock box with gizmo/lock key with key/lock key/lock gizmo with gizmo/lock thingy with thingy/lock box/lock gizmo/lock thingy /lock door.".

        test me with "open door/close door/unlock door/unlock door with key/unlock box/open box/take thingy/close box/lock box with key/unlock gizmo/open gizmo/close gizmo/lock gizmo with key/lock gizmo/open thingy/unlock thingy/open thingy/close thingy/lock thingy with key"

        test whiz with "unlock whizbang/unlock whizbang with key/lock whizbang/lock whizbang with key".