Room & Dimension

version 1 by Sebastian Rahn

  • Home page
  • Beginning
  • Previous
  • Next



  • Example: **** The Curse of Quapeck - A longer example where several possibilities of how to use the given tools are experimented with.


    This example will use some commands from the AI extension namely "[thing] follows [thing]" and "calculate minimum distance between [thing] and [thing]". The first command allows an objects to move to another object on the map. Both objects have to be in the same room for the command to work. The second will save the direct (preferably in a straight line) distance between two objects under the parameter 'Stepscounter'.

        
        *:The Tomb is a room. "You can hardly see anything since the torches you lit earlier (at least you believe it was you) are barely enough to light the centre of the Tomb. A primitive altar out of stone stands there surrounded by four pillars. You remember that there is an Entry to the south although it is hidden in the dark.".
        
        Include Room & Dimension by Sebastian Rahn.
        Include AI Moving by Sebastian Rahn.


    Let us begin by placing the player on the map and spread the coordinates. While we are at it: a short introducing couldn't hurt. The map will always be shown this time.
        
        *:When play begins:
        Change Sector "I" and 10 in Tomb to player;
        spread coordinates;
        Change Show Map to true;
        say "[apostrophe]Outch! That hurts![apostrophe] is the first thing that comes to your mind as you reach for your chest followed by [apostrophe]What the hell happened?[apostrophe]. [line break]You lie face down on muddy floor, you[apostrophe]ve got trouble breathing since every bit of air you inhale is accompanied by even more pain and to top it off your short-term memory seems to take a vacation. Then it dawns you. [apostrophe]Oh my god! I must[apostrophe]ve had an heart attack! Bob even warned me that it was a bad idea climbing down here without having my medicine handy.[apostrophe] Other memories start to tinkle in slowly as you get up. Where are you? A cave? No, you are certain it is a Tomb. The Shapes in your sight become clearer forming space, objects, people. (Why is it so quiet?) As your blurry vision starts to gain more focus you are abruptly confronted with two insights. First that something really horrible just happened and, more importantly, that you are still in danger![paragraph break](Press any key to continue)[paragraph break]";
        wait for any key.
        
        Maximum score is 1.


    This is the map of the starting location:
        
        *:Table 100 - The Tomb
        Number LE A1 B2 C3 D4 E5 F6 G7 H8 I9 J10 K11 L12 M13 N14 O15 P16 Height Width
        1 /Corner -wall -wall -wall -wall -wall -wall -wall -wall -wall -wall -wall -wall -wall -wall -wall -wall 12 20
        2 |wall None None None None None None None None None None None None None None None None
        3 |wall None None None None None None None None None None None None None None None None
        4 |wall None -Wall -Wall None None None None None None None None None None None None -Wall
        5 |wall None -Wall -Wall None None None None None Adam None None None None None None -Wall
        6 |wall None None None None None None None None -Wall -Wall None None None None None None
        7 |wall None None None None None None None None None None None None None None None None
        8 |wall None -Wall -Wall None None None None None None None None None None None None -Wall
        9 |wall None -Wall -Wall None None None None None None None None None None None None -Wall
        10 |wall None None None None None None None None None None None None None None None None
        11 |wall None None None None None None None None None None None None None None None None
        12 \Corner -wall -wall -wall -wall -wall -wall -wall -wall -wall Tomb_South -wall -wall -wall -wall -wall -wall

        Table 101 - The Tomb_2
      Number  Q17   R18   RE  Height  Width  
      1  -wall  -wall  \Corner  12  20  
      2   None   None   |wall  
      3   None   None   |wall  
      4   -Wall   None   |wall  
      5   -Wall   None   |wall  
      6   None   None   |wall  
      7   None   None   |wall  
      8   -Wall   None   |wall  
      9   -Wall   None   |wall  
      10   None   None   |wall  
      11   None   Bob   |wall  
      12   -wall  -wall  /Corner  


    The goal of the first room is to try to rescue Bob, who is located at the lower right corner, by moving to a field next to him. If the player is there, Bob will panic and try to flee the room. After he has left, Adam will start to chase the player. The player, on the other hand, will die if Adam reaches a field next to him. If the player manages to escape, Adam will be placed directly in front of the Entrance Point, preventing the player to re-enter the tomb. We'll need some truth states for this.

        *:Bob running is a truth state that varies.
        Adam chasing is a truth state that varies.

        Pillars is a thing in Tomb. "These pillars have been carved by real craftsmen no doubt although craze craftsmen perhaps. You can see skulls of strange creatures, bizarre hybrids of men and beasts, which are apparently clashed together in a never ending struggle. They always spin around and around the pillar only to start all over again.".
        The description of Pillars is "These pillars have been carved by real craftsmen no doubt although craze craftsmen perhaps. You can see skulls of strange creatures, bizarre hybrids of men and beasts, which are apparently clashed together in a never ending struggle. They always spin around and around the pillar only to start all over again.".
        Understand "Pillar" as Pillars.
        Instead of doing anything other than examining pillars: say "You rather don[apostrophe]t touch them. They could bite.".

        Altar is a thing in Tomb. "The Altar itself is an ungodly ugly thing that seems old enough to originate from the early Bronze Age. Maybe even from the Stone Age for all you care. You feel something strongly repulsive about it as if all your instincts would deliberately try to keep you away. With all the fresh blood spilled on and around the altar you are not certain if you even *want* to get closer.".
        The description of Altar is "This ungodly ugly thing seems old enough to originate from the early Bronze Age. Maybe even from the Stone Age for all you care. You feel something strongly repulsive about it as if all your i nstincts would deliberately try to keep you away. With all the fresh blood spilled on and around the altar you are not certain if you even *want* to get closer.".
        Instead of doing anything other than examining altar: say "You would have to get closer first.".

        Adam is a Hostile person in Tomb. "[If Adam chasing is false]Professor Adam stands next to the altar of Quapeck (from where is that name?). The evil spirits of this place have turned this once affable, well educated man into a monstrous corruption of his former self. He stares at you with a satisfied grin. His teeth covered in red. Your chest starts to hurt even more by the sheer look of it. It is clear that you must get away from that person as fast as possible.[otherwise]It is Professor Adam. Still insane and still with a knife.[end if]".
        The description of Adam is "[If Adam chasing is false]Professor Adam stands next to the stone altar of Quapeck (from where is that name?). The evil spirits of this place have turned this once affable, well educated man into a monstrous corruption of his former self. He stares at you with a satisfied grin. His teeth covered in red. Your chest starts to hurt even more by the sheer look of it. It is clear that you must get away from that person as fast as possible.[otherwise]It is Professor Adam. Still insane and still with a knife.[end if]".
        Instead of doing anything other than examining Adam: say "You prefer to keep your distance from him.".

        Bob is a Friendly person in Tomb. "[If Bob running is false]Bob, your once loyal assistant, cowers in a far away corner of the Tomb muttering to himself in madness. You doubt that he will be much of assistance right now. [otherwise] Bob seems to have completely lost his mind. He runs screaming to the only visible Entry to the south.[end if][If Tomb is not visited][paragraph break][map][end if]".
        The description of Bob is "[If Bob running is false]Bob, your once loyal assistant, cowers in a far away corner of the Tomb muttering to himself in madness. You doubt that he will be much of assistance right now. [otherwise] Bob seems to have completely lost his mind. He runs screaming to the only visible Entry to the south.[end if]".
        Instead of doing anything other than examining or talking to Bob: say "That wouldn't help him.".
        
        Talking to is an action applying to one thing.
        Understand "Talk to [person]" or "Talk [person]" or "call [person]" or "call out for [person]" as talking to.

        Carry out talking to Bob when Bob running is false:
        say "You try to call out for him to get his attention but he is not reacting. Perhaps you[apostrophe]ll have to get closer?".

        Carry out talking to Bob when Bob running is true:
        say "That wouldn[apostrophe]t help. His hysteric screaming would easily drown everything you could muster at the moment.".
        
        Check examining nothing:
        say "There is no time for this nonsense!";
        stop the action.

        Instead of doing something with nothing:
        say "There is no time for this nonsense!".

        Check waiting:
        say "That is clearly one of the last things you want to do right now.";
        stop the action.

        Check examining yourself:
        say "You can leave the medical examination for later!";
        stop the action.
            

    Let's not forget to give Adam and Bob some Avatars.

        *:Table 991 - Avatars (continued)
        Entity Avatar
        Adam "A"
        Bob "B"

        
    Since it can't be an interest of the player to get closer to a dangerous lunatic, we'll try to prevent him from doing so.
        
        *:Closer Look is a Truth State that varies.
        
        Check going a direction (called destination) in Tomb (this is the Lookout rule):
        Change Closer Look to false;
        Ignore the Lookout rule.
        
        The Lookout rule is listed first in the before rules.
        
        Check going west in Tomb:
        If Y-Axis of player is "R"
            begin;
            If X-Axis of player < 8
                begin;
                If X-Axis of player > 5
                    begin;
    Change Closer Look to true;
    end if;
            end if;
        end if.

        Check going northwest in Tomb:
        If Y-Axis of player is "R"
    begin;
            If X-Axis of player < 9
                begin;
                If X-Axis of player > 5
                    begin;
                    Change Closer Look to true;
                end if;
            end if;
        end if;
        If X-Axis of player is 10
            begin;
            Choose row with Letters20 of Y-Axis of player in Table 200;
            If Number Entry > 4
                begin;
                If Number Entry < 18
                    begin;
    Change Closer Look to true;
    end if;
            end if;
        end if.
        
        Check going southwest in Tomb:
        If Y-Axis of player is "R"
            begin;
            If X-Axis of player < 8
                begin;
                If X-Axis of player > 4
                    begin;
                    Change Closer Look to true;
                end if;
            end if;
        end if;
        If X-Axis of player is 3
            begin;
            Choose row with Letters20 of Y-Axis of player in Table 200;
            If Number Entry > 4
                begin;
                If Number Entry < 18
                    begin;
                    Change Closer Look to true;
    end if;
    end if;
        end if.

        Check going east in Tomb:
        If Y-Axis of player is "A"
            begin;
            If X-Axis of player < 8
                begin;
                If X-Axis of player > 5
    begin;
                    Change Closer Look to true;
                end if;
            end if;
        end if.
        
        Check going northeast in Tomb:
        If Y-Axis of player is "A"
            begin;
            If X-Axis of player < 9
                begin;
                If X-Axis of player > 5
    begin;
    Change Closer Look to true;
                end if;
            end if;
        end if;
        If X-Axis of player is 10
            begin;
            Choose row with Letters20 of Y-Axis of player in Table 200;
            If Number Entry > 3
    begin;
                If Number Entry < 17
                    begin;
    Change Closer Look to true;
    end if;
    end if;
        end if.

        Check going southeast in Tomb:
        If Y-Axis of player is "A"
            begin;
            If X-Axis of player < 8
                begin;
                If X-Axis of player > 4
                    begin;
                    Change Closer Look to true;
    end if;
    end if;
        end if;
        If X-Axis of player is 3
    begin;
    Choose row with Letters20 of Y-Axis of player in Table 200;
    If Number Entry > 3
    begin;
    If Number Entry < 17
    begin;
    Change Closer Look to true;
                end if;
            end if;
        end if.
        
        Check going south in Tomb:
        If X-Axis of player is 3
            begin;
            Choose row with Letters20 of Y-Axis of player in Table 200;
            If Number Entry > 4
                begin;
                If Number Entry < 17
                    begin;
                    Change Closer Look to true;
                end if;
            end if;
        end if.
        
        Check going north in Tomb:
        If X-Axis of player is 10
            begin;
            Choose row with Letters20 of Y-Axis of player in Table 200;
            If Number Entry > 4
                begin;
                If Number Entry < 17
    begin;
                    Change Closer Look to true;
                end if;
            end if;
        end if.


    Now to the part when the player tries to go somewhere where he's not supposed to (except he 'rescued' Bob). To determine if the player wants to use the southern Entry we use a technique that will also come in handy for the next room. Basically, we mime the check run of the original 'Moving player' rule (from "Change Compass to player;" to "check sector;"), that changes the parameter 'Freespace' to the object that is present in the sector the player wants to go. Since it is a more specific rule than the 'moving player' rule the new rule will always be called first.

        *:Check going a direction (called destination) in Tomb (this is the Tomb Script rule):
        If Closer Look is true
            begin;
            say "You try to get closer to the altar but as you step between the pillars sudden, intense agony fills your body. Adam laughs hysterically as you stumble back writhing in pain.";
            stop the action;
        end if;
        Change Compass to player;
        Change Tmp_Direction to destination;
        turn around;
        check sector;
        If Freespace is Tomb_South
            begin;
            If Bob is in Tomb
                begin;
                say "You look back to see Bob still sitting in his corner. Despite all your fear, you can[Apostrophe]t just leave him behind with this madman.";
                stop the action;
            end if;
            If Adam chasing is true
                begin;
                remove adam from map;
                Change sector "J" and 11 in Tomb to Adam;
                Change Adam chasing to false;
            end if;
        end if.
        
        
    This segment handles the situation where either Bob is fleeing or Adam is chasing the player. The 'Tomb_South' must be moved to the tomb to make the "Bob follows Tomb_South;" line taking any effect. We also try out the "calculate minimum distance" command so we can leave a comment if Adam comes closer. (Disclaimer: Since some bizarre timing thing, that I couldn't figure out yet, you'll have to place the calculating distance command before the following command)
        
        *:Every turn (this is the Bob discovered rule):
        If Bob running is true
            begin;
            move Tomb_South to Tomb;
            If Bob is connected with Tomb_South
                begin;
                Completely remove Bob from map;
                Change Bob running to false;
                say "Shortly after you[Apostrophe]ve lost Bob out of sight you can hear an unpleasant crunching noise followed by eerie silence. [Apostrophe]Poor Bob,[Apostrophe] Adam looks amused [Apostrophe]never was the cautious type. But we should attend to our own little agenda now. Isn[Apostrophe]t that right, Mr. Anderson?[Apostrophe] He comes out from behind the altar. Judging by the large knife he is holding you think it is time to depart.";
                Change Adam chasing to true;
            otherwise;
                Bob follows Tomb_South;
            end if;
            move Tomb_South to EP;
        end if;
        If Bob is in Tomb
            begin;
            If player is connected with Bob
                begin;
                say "You place your hand on Bob[Apostrophe]s shoulder who finally turns around to face you. The expression of utter despair that marks his face is truly shocking. As your eyes meet he seems to be trapped in a moment of disbelief. Then he suddenly starts to scream at the top of his lungs and pushes you away with all his strength. You stumble back in surprise and brutally collide with the pillar behind you. While you try to get back on your feet you can see his silhouette running to the southern exit, still screaming.";
                remove Bob from map;
                Change sector "L" and 11 in Tomb to Bob;
                remove player from map;
                Change sector "P" and 10 in Tomb to player;
                Change Looking Direction of player to Face South;
                Change Bob running to true;
            end if;
        end if.

        The Bob discovered rule is listed before the Print map rule in the every turn rules.
        
        Every turn (this is the Adam chasing player rule):
        If Adam is connected with player
            begin;
            say "The pain finally gets the better of you and forces you to your knees. You prepare for cold steel to cut your throat as Adam reaches you. Suddenly, Adams lowers his knife and touches your chest with the other hand muttering in a tongue you don[Apostrophe]t understand. Cognizance strikes you as you start to lose consciousness, never to awake again.";
            end the game in death;
        end if;
        If Adam chasing is true
            begin;
            calculate minimum distance between player and Adam;
            Adam follows player;
            If stepscounter is 3, say "You can feel your heart pounding faster while the distance between you and Adam diminishes.";
            If stepscounter is 2, say "Your chest starts to hurt.";
            If stepscounter is 1, say "Your torso seems to vibrate in pain. You need to get out of here!";
        end if.
        
        
    Continue on to the next room.

        *:Table 102 - Tunnel
        Number LE A1 B2 C3 RE Height Width
        1 /Corner -Wall Tunnel_North -Wall \Corner 9 5
        2 |Wall None None Trap |Wall
        3 |Wall None None None |Wall
        4 |Wall Trap None Trap |Wall
        5 Tunnel_West Trap None None |Wall
        6 |Wall None Trap None |Wall
        7 |Wall None Trap Trap |Wall
        8 |Wall Trap None Trap |Wall
        9 \Corner -Wall -Wall -Wall /Corner


    There are some traps placed here to hinder the player in his escape. To make thing a little bit more interesting, it is also completely dark.

        *:Tunnel is a dark room.
        Tunnel is south of Tomb.
        Trap is a thing.

        Table 991 - Avatars (continued)
      Entity  Avatar  
      Trap  "x"  

        Check going a direction (called destination) in Tunnel (this is the Tunnel Script rule):
        Change Compass to player;
        Change Tmp_Direction to destination;
        turn around;
        check sector;
        If Freespace is trap [Player finds a trap]
    begin;
            say "You stumble forward in your desperate attempt to escape as you come to realize that there is actually no floor to stand on. The scream that leaves your mouth as you fall into a void of blackness will haunt this place for all eternity.";
            end the game in death;
        end if;
        If Freespace is Tunnel_West [Player finds the Entry -> Trapping him in the Void]
            begin;
            remove player from map;
            move player to Void;
            say "[Apostrophe]Do you allready want to leave us, Mr. Anderson?[Apostrophe][paragraph break]You find yourself...somewhere..else.";
            Change sector "D" and 5 in void to player;
            move Void_East to Void;
            remove Void_East from map;
    move Void_East to EP;
            stop the action;
        end if.


    Now for the final destination:
        
        *:Table 103 - The Void
        Number LE A1 B2 C3 D4 E5 F6 G7 H8 I9 RE Height Width
        1 None None None None None None None None None None None 11 11
        2 None None None None None None None None None None None
        3 None None None None None None None None None None None
        4 None None None None None None None None None None None
        5 None None None None None None None None None None None
        6 None None None None None None None None None None None
        7 None None None None None None None None None None None
        8 None None None None None None None None None None None
        9 None None None None None None None None None None None
        10 None None None None None None None None None None None
        11 None None None None None None None None None None None


    We'll find out what happens if we decrease the Height and Width Entry of a map.

        *:The Void is a room. The description of void is "[if Void is visited]There is nothing to say. That is exactly why this place is so scary in the first place.[end if]".
        The Void is west of Tunnel.
        Listcounter is a number that varies.
        
        Comment counter is a number that varies.
        
        Every turn when player is in the Void (this is the Void Script rule):
        Increase Comment counter by 1;
        Change compass to player;
        calculate coordinates;
        choose row with Letters28 of Y-Axis of player in Table 200;
        Change Listcounter to Number Entry;
        choose row 1 in Table 103;
        If Height Entry > 1
            begin;
            Change Height Entry to Height Entry - 1;
            Change Width Entry to Width Entry - 1;
            If X-Axis of player is (Height Entry + 1), decrease X-Axis of player by 1;
            If Listcounter is Width Entry, Change Y-Axis of player to "RE";
            If Width Entry is 1, Change Y-Axis of player to "LE";
            let X be X-Axis of player;
    let Y be Y-Axis of player;
    remove player from map; [This command is only necessary if we want to expand the map again in the future]
            Change sector Y and X in Void to player;
        end if;
        If Comment counter is 1, say "This is certainly not a place you[apostrophe]ve seen before. Where are you?";
        If Comment counter is 2, say "You desperately turn from one direction into another. There must be a way out!";
        If Comment counter is 3, say "There was something you[apostrophe]ve heard earlier. It was something important. Why can[apostrophe]t you remember?";
        If Comment counter is 4, say "What was it? Some Voodoo Mumbo Jumbo.";
        If Comment counter is 5, say "Mind? Body? You can[apostrophe]t make a sense of it.";
        If Comment counter is 6, say "First, the body is struck down and torn open. That will prepare the vessel.";
        If Comment counter is 7, say "You can hear Adam laughing in a distance.";
        If Comment counter is 8, say "A very important thing from the body is stolen.";
        If Comment counter is 9, say "Your chest pain returns.";
        If Comment counter is 10, say "This is a mere preparation to ensure that the mind will be destroyed as well.";
        If Comment counter is 11, say "You lower your gaze to examine the source of your torment. It becomes clear by closer inspection that someone, probably Adam, took the freedom to cut you open, remove your ribs and take the heart. For some strange reasons you find this quiet amusing.";
        If Comment counter is 12
            begin;
            say "And when the mind has faded the Soul shall join our choir to bring forth and speak truly in the name of Quapeck!";
            Increase Score by 1;
            end the game saying "You[apostrophe]ve finally found your true calling.";
        end if.
        
        
    This rule is a precaution in case the player wants to go to a sector that no longer exists.
        
        *:Check going a direction (called destination) in Void (this is the Second Void Script rule):
        choose row with Letters28 of Y-Axis of player in Table 200;
        Change Listcounter to Number Entry;
        Choose row 1 in Table 103;
        If Height Entry is not 1
            begin;
            If Listcounter is Width Entry, stop the action;
        end if.
        
        The Void Script rule is listed before the print map rule in the every turn rules.
        

    Now we'll connect rooms and tables.
        
        *:Table 997 - Sectors (continued)
        Sector Room Table Table 2
        The Tomb Table 100 Table 101
        Tunnel Table 102
        The Void Table 103
        

    And here we declare our Entrance Points. Note that we actually don't need the Void_East Entrance Point anymore but we'll keep it in case that we might want to test if the West and East Entrance Points works properly.
        
        *:Tomb_South is a South Entrance Point in EP room.
        Tunnel_North is a North Entrance Point in EP room.
        Tunnel_West is a West Entrance Point in EP room.
        Void_East is a East Entrance Point in EP room.
        
        Table 994 - Junctures (continued)
      Entrance   Exit Point   Exit Room   Position_1   Position_2  Position_3  Height_1  Height_2  Height_3  Entrance_Height  
      Tunnel_North   Tomb_South   The Tomb   ""   "J"   ""   0   0   0    11  
      Tomb_South   Tunnel_North   Tunnel   "A"   "B"   "C"   0   0   0    2  
      Tunnel_West   Void_East   The Void   ""   ""   ""   4   5   6   5  
      Void_East   Tunnel_West   Tunnel   ""   ""   ""   4   5   6   5