Exit Lister

version 1 by Andre Kosmos

  • Home page
  • Complete text



  • exit lister by Andre Kosmos begins here.

    A door has a text called passing text. Passing text of a door is usually "through".

    To say closed door: say "(closed)".

    To say exit list:
        let place be location;
        let counter be 0;
        repeat with way running through directions
        begin;
            let place be the room way from the location;
            if place is a room then increase counter by 1;
        end repeat;
        if counter is 0 then say "nowhere";
        repeat with way running through directions
        begin;
            let place be the room way from the location;
            if place is a room
            begin;
                Let gateway be location;
                if mentioning doors is yes
                    begin;
                    repeat with item running through doors
                        begin;
                            if front side of the item is location and back side of the item is place then let gateway be item;
                            if front side of the item is place and back side of the item is location then let gateway be item;
                        end repeat;
                    end if;
                    decrease counter by 1;
                    say "[way]";
                    if gateway is not location
                    begin; say " [passing text of gateway] [the gateway]";
                        if gateway is closed then say "[closed door]";
                    end if;
                if place is visited and room memory is yes then say " to [place]";
                if counter is greater than 1 then say ", ";
                if counter is 1 then say " or ";
            end if;
        end repeat.
        
    listing exits is an action applying to nothing.
    understand "exits" as listing exits.
    carry out listing exits: say "You can go [exit list] from here.".
    Yes_No_flag is a kind of value.
    Yes_no_flags are yes and no.
    List exits is an Yes_no_flag that varies. List exits is yes.
    mentioning doors is an Yes_no_flag that varies. mentioning doors is yes.
    Room memory is an Yes_no_flag that varies. Room memory is yes.

    This is the exits rule: if list exits is yes then say "You can go [exit list] from here.".
    The exits rule is listed last in the carry out looking rules.

    Turning exits on is an action out of world.
    Understand "exits on" as turning exits on.
    carry out turning exits on: change list exits to yes.
    Report turning exits on: say "(exits listing is on)".

    Turning exits off is an action out of world.
    Understand "exits off" as turning exits off.
    carry out turning exits off: change list exits to no.
    Report turning exits off: say "(exits listing is off)".

    To don't mention doors: now mentioning doors is no.
    To mention doors: now mentioning doors is yes.
    To mention visited rooms: now room memory is yes.
    To don't mention visited rooms: now room memory is no.


    exit lister by Andre Kosmos ends here.