Instead of Going

version 3/071115 by Mikael Segercrantz

  • Home page
  • Beginning
  • Previous
  • Next



  • Chapter 2(c) - Other rules

    Section 2(c)1 - To list available exits

    To list available exits, mentioning visited rooms or mentioning all rooms:
        let count be 0;
        repeat with way running through directions
        begin;
            let place be the room the way from the location;
            if place is a room, increase count by 1;
        end repeat;
        if count is 0
        begin;
            say "[No way out][paragraph break]";
        otherwise;
            if count is 1, say "[Only one exit]";
            otherwise say "[Multiple exits]";
            let original count be count;
            repeat with way running through directions
            begin;
                let place be the room the way from the location;
                if place is a room
                begin;
                    say " [way]";
                    if mentioning visited rooms and place is visited, say " (to [the place in lower case])";
                    if mentioning all rooms, say " (to [the place in lower case])";
                    let count be count minus 1;
                    if count is 0, say ".";
                    if count is 1 and original count is 2, say " and";
                    if count is 1 and original count is not 2, say "[can't go to optional comma] and";
                    if count is at least 2, say ",";
                end if;
            end repeat;
        end if.