Room & Dimension

version 1 by Sebastian Rahn

  • Home page
  • Beginning
  • Previous
  • Next



  • Example: *** The Lair of Don Capone - A small game scenario to test room connections, if a person stands next to another and if the program will recognize obstacles like walls and hostile persons.

    We have to make some slight changes compared to the first example since this time, we want to print the map every turn from start to finish. Therefore, we place the starting room before the extensions and let its description print the map for the very first time.

        *:The Streets is a room. "It is a lively day on Chepston Streets as usual. The Don Capone, restaurant of the rich and morally challenged, stands before you. The place where you want to go. [If Streets is unvisited][paragraph break][map][end if]".

        Include Room & Dimension by Sebastian Rahn.


    Let's start again by creating our first room. This time thought we will need a so called Entrance Point. Since we place the entrance of the restaurant to the South at it is seen on the map below, this will be a South Entrance Point. We may not forget to put all Entrance Points in the EP Room.
        
        *:Table 100 - The Streets
        Number LE A1 B2 C3 RE Height Width
        1 -Wall -Wall -Wall -Wall -Wall 7 5
        2 Jenny None None None None
        3 None None None None None
        4 None None None None None
        5 None None None None None
        6 None Bully2 Bully1 Bully3 None
        7 -Wall -Wall Southdoor -Wall -Wall

        Table 997 - Sectors (continued)
      Sector Room  Table   
      Streets  Table 100   

        Southdoor is a South Entrance Point in EP.
        Bully1 is a hostile person in Streets. The printed name of Bully1 is "Bulky Bully". The description of Bully1 is "Gee, that's a big fellow!".
    Understand "Bulky Bully" as Bully1.
        Bully2 is a hostile person in Streets. The printed name of Bully2 is "Slimy Bully". The description of Bully2 is "You can tell by the looks of him that you won't become friends.".
        Understand "Slimy Bully" as Bully2.
        Bully3 is a hostile person in Streets. The printed name of Bully3 is "Bland Bully". The description of Bully3 is "Now you know what pure average looks like.".
        Understand "Bland Bully" as Bully3.
        Jenny is a friendly person in Streets. The description of Jenny is "Flatear Jenny is an old acquaintance of yours and always helpful when it comes to this kind of situations. Maybe you should talk to her.".


    Since we got other people in the room except the player, we must prepare Avatars so that the map will print out properly .

        
        *:Table 991 - Avatars (continued)
        Entity Avatar
        Bully1 "B"
        Bully2 "s"
        Bully3 "b"
        Jenny "J"

        Talking to is an action applying to one visible thing.
        Understand "Talk to [person]" or "Talk [person]" as Talking to .

    Carry out Talking to someone (called actor):
        If actor is not Jenny, say "That wouldn[apostrophe]t achieve anything".


    We want the player to only be able to greet Jenny while she is in a neighbouring field. Therefore:

        *:Check Talking to Jenny:
        If Jenny is not connected with player
            begin;
            say "Flatear Jenny won[apostrophe]t hear you as long as you don't come closer.";
            stop the action;
        end if.

    There is also the possibility to ask "If [thing] is connected with [thing]" although this is not neccessary here.
    Anyways, after the player talks to Jenny she and the bullies will be completely removed from the map, meaning that they will also be removed from the game since we no longer need them. If we want them to remain in game we can use the "remove [person] from map" command instead. This would not remove them from the room however.

        *:Carry out Talking to Jenny:
        say "You have a little conversation in which both of you repeatedly turn your heads over to the musclemen that block the entrance of the restaurant. After you pass a few bills, Jenny walks over to them. Two minutes later your path is clear. Jenny has proven reliable as always.".
        completely remove Jenny from map;
        completely remove Bully1 from map;
        completely remove Bully2 from map;
        completely remove Bully3 from map.


    Onwards into the restaurant.

        *:The Restaurant is a room. The Restaurant is south of Streets. The description of restaurant is "This place isn[apostrophe]t as grand as you thought it would be. But this comes with the advantage that the food counter isn[apostrophe]t too far away neither.".

        Table 101 - The Restaurant
      Number   LE   A1   RE   Height   Width  
      1  /Corner  Northdoor  \Corner   6   3  
      2  |Wall  None  |Wall  
      3  |Wall  None  |Wall  
      4  |Wall  -Wall  |Wall  
      5  |Wall  Waiter  |Wall  
      6  \Corner  -Wall  /Corner  
        
        Table 997 - Sectors (continued)
      Sector Room  Table   
      Restaurant  Table 101   

        Northdoor is a North Entrance Point in EP.
        Waiter is a person in restaurant. The description of Waiter is "This man looks quiet bored.".

        Table 991 - Avatars (continued)
      Entity  Avatar  
      Waiter  "W"  

    We set up a winning condition for the game: get food!

        *:Every turn when player is in restaurant:
        If X-Axis of player is 3
            begin;
            say "[apostrophe]Hello Sir, may I take your order?[apostrophe] You are delighted. This evening is going to be delicious!";
            end the game in victory;
        end if.


    We now have two Entrance Points: Southdoor in Streets and Northdoor in the Restaurant. If we want to connect them, we'll have to expand this Table:

        *:Table 994 - Junctures (continued)
        Entrance Exit Point Exit Room Position_1 Position_2 Position_3 Height_1 Height_2 Height_3 Entrance_Height
        Southdoor Northdoor Restaurant "" "A" "" 0 0 0 2
        Northdoor Southdoor Streets "A" "B" "C" 0 0 0 6

    Granted that this looks rather complicated.
    Basically, we declare an Entrance Point that we enter (Entrance Entry) and the one we leave (Entrance Point). Those two are important for the program to recognize which maps should be used (the ones where each Entrance Point is located, at least on the map). The Exit Room Entry is simply the room where the moving actor is taken to. The three Position_x Entries are exclusively for South and North Entrance Points. With them we can determine in which column the actor will appear. The program will try first to move the actor to Position 2 and then work its way back to 3. If all of them are either occupied or not available (marked with "" as demonstrated in the first row of the above example) the actor will not move to the Exit Room but remains where he is. The Height_x Entries do pretty much the same for the West and East Entrance Points as Position_x for North and South but, as we can see, use numbers instead of Letters (0 equals "" in this case). The Entrance_Height Entry is only important for South and North Entrance Points as it determines the row in which the actor is placed.

    The last function that is introduced in this example is the "change sector [Y-Axis] and [X-Axis] in [room] to [thing]" to place the player on the map. Objects that are placed with this command won't be moved from room to room and the old Entry on the map will also not be removed meaning that, before we use this command to move an object, we first have to delete it from the map, move it to its destination and then use the command. We can use either the corresponding letter for the Y-Axis (like "A" for the A1 Entry. The left and right ends of the map are reffered to as "LE" and "RE") or a number while the X-Axis is always a number. If there is an object in the picked sector it will only be overwritten on the map and not removed from the room. There is also another command that works in a similar fashion called "pick sector [Y-Axis] and [X-Axis] in [room]", that will not change the chosen sector but takes its object and save it under the parameter 'Tmp_Picked'.

        *:When play begins:
        change sector "B" and 5 in Streets to player;
        Spread Coordinates;
        Change Show Map to true.