Automap

version 4 by Mark Tilford

  • Home page
  • Beginning
  • Previous



  • Example: ** The Demonstration - A simple demonstration.

        "The demonstration" by Mark Tilford.

        Include Automap by Mark Tilford.
        Use automap hide paths through closed doors;
        Use automap reserved area of at least 400;
        Include Basic Hyperlinks by Emily Short;
        Use automap hyperlinks;

        When play begins: now current zoom is map zoomed in.
        
        [The western hall is a mappable room.
        The eastern hall is a mappable room. It is east of western hall.
        The southern hall is a mappable room. It is southeast of western hall. It is southwest of eastern hall.]
        The heavy door is south of the western hall and north of the office. It is a door.
        [The office is a mappable room.]
        The southern hall is southeast of western hall and southwest of eastern hall. The eastern hall is east of western hall.
        The heavy door is a door. It is south of the western hall and north of the office.
        
        Fooing is an action applying to nothing. Understand "foo" as fooing.

        Before fooing when the player is in eastern hall or the player is in western hall:
            say "To make a longer path, the distance must be declared both ways."
        To decide what number is the distance (d - east) from (r - western hall): decide on 2.
        To decide what number is the distance (d - west) from (r - eastern hall): decide on 2.

        [The western balcony is a mappable room. It is up from western hall.
        The central balcony is a mappable room. It is east from western balcony.
        The eastern balcony is a mappable room. It is east from central balcony. It is up from eastern hall.]
        The western balcony is up from western hall and west from central balcony.
        The eastern balcony is east from central balcony and up from eastern hall.

        Outside Building is a mappable room. It is west from western balcony.

        Before fooing when the player is in western balcony or the player is in eastern balcony:
            say "By default, rooms connected with up / down / in / out are not placed on the same map. If you want to put them on the same map, you can position them manually."
            
        Before constructing the status line:
            unless western balcony is placed 0 and -1 from western hall, say "*** Error placing west balcony ***";
            unless eastern balcony is placed 0 and -1 from eastern hall, say "*** Error placing east balcony ***";
            unless upstairs closet is placed -1 and 0 from upstairs office, say "*** Error placing upstairs closet ***".
            
        [Upstairs office is a mappable room. It is north of western balcony.
        Upstairs closet is a mappable room. It is inside from upstairs office.]
        Upstairs office is north of western balcony.
        Upstairs closet is inside from upstairs office.

        Stupid room is a mappable room. It is east from upstairs office.

        Alpha room is east of stupid room.
        Beta room is north of alpha room and northeast of stupid room.
        Gamma room is west of beta room and northwest of alpha room and north of stupid room.
        Joe's room is southeast of beta room.
        Fred's room is northeast of beta room and north of Joe's room.
        Jane's room is east of beta room and southeast of fred's room and northeast of Joe's room.
        To decide what number is the distance (d - east) from (r - beta room): decide on 2.
        To decide what number is the distance (d - west) from (r - jane's room): decide on 2.
        To decide what number is the distance (d - north) from (r - joe's room): decide on 2.
        To decide what number is the distance (d - south) from (r - fred's room): decide on 2.


        Before fooing in elevator:
            say "If you want to move a room on the map, you'll have to unmap it first."
            
        The elevator is a mappable room. The elevator can be high or low. It is low.
        The elevator is east of eastern hall.
        The button is in the elevator. It is fixed in place.
        Instead of pushing the button:
            say "The doors shut; the elevator shakes briefly, then the doors open again.";
            unmap the elevator;
            If the elevator is low begin;
                now the elevator is high;
                change the east exit of eastern hall to nothing;
                change the east exit of eastern balcony to elevator;
                change the west exit of elevator to eastern balcony;
            otherwise;
                now the elevator is low;
                change the east exit of eastern hall to elevator;
                change the east exit of eastern balcony to nothing;
                change the west exit of elevator to eastern hall;
            end if.
                
        before fooing when the player is in western balcony or the player is in outside building:
            say "If you want to split rooms into separate map regions despite them being reachable from each other by compass points, you can override the decision so that it has a different value while working with the automap than when making ordinary movement."

        Phony Room is an unmappable room. It is west of office and southwest of western hall.

        To decide what room is the room (dir - west) from (room - western balcony):
            if handling the automap work activity, decide on Phony Room.

        To decide what room is the room (dir - east) from (room - outside building):
            if handling the automap work activity, decide on Phony Room.

        To decide what number is the distance (dir - west) from (room - western balcony): decide on 3.
        
        before fooing when the player is in western balcony or the player is in eastern balcony:
            say "(Current versions of Inform do not go through the decision mechanism when responding to the player's compass movements, so the 'if handling the automap work activity' check may not be necessary. Something like 'decide on nothing / nowhere' end should theoretically allow hiding a passage completely, but all I got were syntax errors.)[line break]"

        before fooing the first time:
            say "You must set the displayed size of the map before it is displayed. This can be changed at any time not during automap work.[line break]
            To fix the size at the start, use something like 'When play begins: Reserve automap memory of 13 rows by 17 cols;'.[line break]
            Omitting the columns will have it allocate memory to fill the width of the screen, but you must readjust each time the status line is rebuilt.[line break]
            In Glulx games, it will automatically allocate memory as needed. In Zcode games, you must reserve that memory in advance:
            Use automap reserved area of at least 400. (It's okay to put such a line in a Glulx game; it will be ignored.)[line break]
            In ZCode mode, you must print at least as many blank lines as your map is high so that the text will start out below the automap.[line break]
            Map sizes are in characters; a room is 1 character square in zoomed out mode, 3 characters square in zoomed in mode."

        Section 99Z (for Z-machine only)
        
            When play begins: say "[map height blank lines]"
        
        Section 1

        before fooing the first time: say "If you want something other than the usual line above your map, you'll need to build the status line yourself.[line break]"
        
        The first for constructing the status line rule:
            reserve automap memory of 13 rows;
            fill status bar with table of mostly ordinary status and map.

        Table of Mostly Ordinary Status
      left  central  right  
      "[location]"  ""  "[score]/[turn count]"   
      "---"  "---"  "---"  
        
        Section 98 (for use with Basic Hyperlinks by Emily Short)

        Current autowalk destination is a room that varies. Autowalk destination set is a truth state that varies.
        
        autowalking is an action applying to one topic. Understand "autowalk to [text]" as autowalking.
                
        Carry out autowalking:
            if autowalk destination set is true begin;
                now autowalk destination set is false;
                try hyperlink moving to room current autowalk destination;
            otherwise;
                say "(Autowalk is meant to be generated by hyperlinks, not typed directly.)";
            end if.
        
        The first clicking hyperlink rule:
            [say "Clicked on link [current link number].";]
            if current link number codes a glulx object begin;
                [try hyperlink moving to room glulx equivalent of current link number;]
                change current autowalk destination to glulx equivalent of current link number;
                now autowalk destination set is true;
                now glulx replacement command is "autowalk to [current autowalk destination]";
                rule succeeds;
            end if;