Restrictions

version 2 by Jon Ingold

  • Home page
  • Beginning
  • Previous



  • Example: ** Catwalk - Your average catwalk-dangling situation.

        "Cliffhanger"

        Include Restrictions by Jon Ingold.

        The Catwalk is a room. "The catwalk hovers far above the dusty floor below[if the location is currently restrictive]. So do you[end if]." The restriction message of the Catwalk is "clinging to the railing". The railing is scenery in the Catwalk. The dusty floor below is a supporter and scenery in the catwalk. The description of the dusty floor is "[if the floor supports something]On the floor below is [the list of things on the dusty floor][otherwise]The floor is a long, long way down[end if].".Instead of doing something other than examining to the dusty floor, say "It's too far away."

        The player is carrying a apple and a hat. The apple is edible. The hat is wearable.

        Before climbing railing when not restricted in the Catwalk, try jumping instead.

        [ The player can jump, and suddenly the location is restrictive! ]

        Instead of jumping in the catwalk when the catwalk is not currently restrictive:
        now the catwalk is currently restrictive;
        say "You fling yourself over the railing, only catching your fall with one hand."

        [ Actions involving the railing -- and snacking -- are allowed. That means their before routines succeed. ]

        Restricted before rule in the Catwalk when eating the apple: rule succeeds.

        Restricted before rule in the Catwalk when the noun is the railing:
        rule succeeds.

        [ We can pull ourselves back, or let go: these are interactions with the railing so they're handled using normal "instead" rules. Note the "when restricted in the Catwalk" condition. ]

        Instead of pulling the railing when restricted in the Catwalk:
        now the location is not currently restrictive;
        say "You haul yourself back over the railing." instead.

        Instead of dropping the railing when restricted in the Catwalk:
        end the game saying "You plummet to your death." instead.

        [ And for things which we are restricted from doing, we can supply new error messages in the "restricted instead rules". If we don't, we'll just get the "both hands"... message. ]

        Restricted instead rule when in the catwalk:
        say "You're using both hands just to hold on." instead.

        Restricted instead of dropping something held by the player in the catwalk:
        move the noun to the dusty floor;
        say "You relinquish [the noun] and it disappears to the floor below." instead;

        Test me with "jump / pull railing / jump / eat apple / wear hat / drop hat / drop railing".