Protagonists

version 1/120327 by Kevin Norris

  • Home page
  • Beginning
  • Previous



  • Example: *** Flight - Defining a new order.

    Here's most of an implementation for a new order "flee", which would cause fearful followers to flee the room, possibly scattering them to many different rooms:
        
        *:"Flight"
        
        Include Protagonists by Kevin Norris.
        Include Questions by Michael Callaghan.
        
        Section 1 - The "flee" order
        
        Definition: A person is afraid if it can see the beast
        
        Table of Orders (continued)
      Order  Printed description  Targeted people  
      flee  "Run away."  --  
        
        When play begins:
            Target flee at visible obedient other afraid people.
        
        Giving an order to someone (called P) when the relevant order is flee:
            Let place be a random adjacent room;
            If place is a room:
                Let thataway be the best route from the location of P to place;
                If thataway is a direction:
                    Silently try P going thataway;
                    If rule succeeded:
                        Silently try P waiting;
                        It is complied with;
            It is not complied with.
        For printing the failure to comply of someone (called P) when the relevant order is flee:
            Say "[The P] appear[s] to be stuck here."
        For printing the compliance list of a list of people (called A) when the relevant order is flee:
            Say "[The list of things included by A] flee[list-based s of A] the area."
        
        Section 2 - The Scenario

        The Canyon is a room. "You are at the bottom of a canyon. There is a passage to the south."
        Alice is a playable woman in the canyon.
        Bob is a playable man in the canyon.
        Carol is a playable woman in the canyon.
        David is a playable man in the canyon.
        The player carries a lamp. The lamp is a device.
        Carry out switching off the lamp:
            Now the lamp is not lit.
        Carry out switching on the lamp:
            Now the lamp is lit.
        Instead of burning the lamp:
            Try switching on the lamp.
        The Cave is a dark room. "Your lamplight casts hundreds of shadows all over the cave. There are exits in the four cardinal directions."
        The Narrow passage is north of the cave. "The passage extends north and south." The narrow passage is dark.
        South of the canyon is the narrow passage.
        The Dead end is west of the cave. "You can only return to the east." It is dark.
        The Twisty passage is east of the cave. "This passage twists around and confuses your sense of direction. It looks like you can go north and south from here." It is dark.
        North of the twisty passage is the cave.
        West of the twisty passage is nowhere.
        The Curved passage is south of the cave. "This passage is a straightforward curve from the north to the east." It is dark.
        East of the curved passage is south of the twisty passage.
        The Beast is an animal in the cave.
        Test me with "light lamp / order / 1 / s / s / order / 2 / n / s / w / e / s / e / n"

    Note that this does not cause the player to flee when the order is given. This is because orders never target the player. However, in this case it may be a good idea to have the player comply as well:
        
        *:After ordering a group to flee:
            Let place be a random adjacent room;
            If Place is a room:
                Let thataway be the best route from the location to place;
                If thataway is a direction:
                    Try going thataway.