Room & Dimension

version 1 by Sebastian Rahn

  • Home page
  • Beginning
  • Previous
  • Next



  • Example: * One Room creation - Creating a small test room and a command that will either make the corresponding map appear or disappear.

        Include Room & Dimension by Sebastian Rahn.


    Let us begin by creating a room and giving it some shape.
        
        *:Test room is a room.
        
        Table 100 - Test Room
      Number   LE   A1   B2   C3   RE   Height   Width  
      1   None  None  None  None  None   5   5  
      2   None  None  None  None  None        
      3   None  None  Yourself  None  None        
      4   None  None  None  None  None        
      5   None  None  None  None  None        


    That's pretty bland but suitable for this demonstration. Note that if you want to place a player character other than 'Yourself' on the map you'll either have to use the name of said character instead or, if you really want to use 'Player', then there is another option that will be demonstrated in the next example.

    Now we create a link between the room and the corresponding map.

        *:Table 997 - Sectors (continued)
        Sector Room Table
        Test Room Table 100
        

    If we don't want to show the map all the time, we can create a command that will switch the Truth State 'Showing map' either to true or false which will either show the map or prevent it from being printed.
        
        *:Work Done is a truth state that varies.
        
        Showing map is an action applying to nothing.
        Understand "Show map" or "Map" as Showing map.
        
        Carry out Showing map:
        Change Work Done to false;
        If Show Map is false
            begin;
            Change Show Map to true;
            Change Work Done to true;
            say "You unfold your map to look where you are.";
        end if;
        If Work Done is false
            begin;
            Change Show Map to false;
            say "You put the map back into your bag.";
        end if.
        

    We have to be careful of the EP room, where all Entrance Points are stored, as it will most likely be declared the starting room since it is probably created first. To prevent this we either make sure that the player is moved to the place we want him at the start of the game (like in this example) or create the starting location before including the extension. Also, since we're lazy, we don't give the player any coordinates on his way but let the program figure it out with the "Spread Coordinates" command.
        
        *:When play begins:
        Move player to Test room;
        Spread Coordinates.