Player Experience Upgrade

version 2/111127 by Aaron Reed

  • Home page
  • Beginning
  • Previous
  • Next



  • Chapter - Exit leaves when there's only one way to go

    [If a room only has a single exit, typing EXIT should use it. Works through doors. This extends the functionality in Emily Short's Modified Exit, which is already overriding the Standard Rules here. ]

    Check an actor exiting (this is the Small Kindnesses exit leaves when there's only one way to go rule):
        let the local room be the location of the actor;
        if the container exited from is the local room:
            if the actor is the player and the count of indirectly-adjacent rooms is 1:
                let way be best route from location to the first indirectly-adjacent room, using even locked doors;
                if way is inside:
                    issue library message going action number 2 for the local room;
                    stop the action;
                if way is a direction, convert to the going action on way;
            otherwise if the room-or-door outside from the local room is not nothing:
                convert to the going action on the outside.

    To decide what number is the count of indirectly-adjacent rooms:
        let ctr be 0;
        repeat with dir running through directions:
            let dest be the room-or-door dir from location;
            if dest is a room:
                increase ctr by 1;
            otherwise if dest is a door and the other side of dest from location is a room:
                increase ctr by 1;
        decide on ctr.

    To decide what room is the first indirectly-adjacent room:
        repeat with dir running through directions:
            let dest be the room-or-door dir from location;
            if dest is a room:
                decide on dest;
            otherwise if dest is a door and the other side of dest from location is a room:
                decide on the other side of dest from location;
        decide on location.