Patrollers

version 12 by Michael Callaghan

  • Home page
  • Beginning
  • Previous
  • Next



  • Section: Creating our own restrictions
    To create our own restrictions on a patroller's movement, we add the following lines:
        To decide if (R - a Room) is off-limits to (P - a Patroller):
            conditions to bar or allow access;
                decide yes or no;
            other conditions to bar or allow access;
                decide yes or no;
            any further conditions to bar or allow access;
                decide yes or no;
            decide no.
    The code should always end with an unconditional "decide no." to ensure that the default position for any room / patroller combinations that fall outside our conditions is to allow access to the room.
    If we have two or more patrollers, we must add the conditions under the one "To decide" heading. Similarly, if there are two or more conditions applying to the same patroller, they must also be under the one "To decide" heading. The net result is that our code should only contain one "To decide" heading to encompass all of our restrictions on patrollers movements.
        To decide if (R - a Room) is off-limits to (P - a Patroller):
            if P is NPC1:
                conditions to bar or allow access;
                    decide yes or no;
            if P is NPC2:
                conditions to bar or allow access;
                    decide yes or no;
            decide no.