1. Introduction to Rooms
  2. How Do I Make a Room
  3. Advanced Features
  4. Example Rooms

  1. Introduction to Rooms

       All rooms must include the following lines:
           inherit ROOM;
           void setup(){
           The line inherit ROOM;  is the base for all rooms, this gives
           your room abilities like exits, and descs.  Without this your
           room will not load.
           The setup function is where MOST of what makes your room a room
           goes.  The long description, the exits etc will be defined in this
       Room Descriptions
          Rooms should be very descriptive, and not just copies of the same
          rooms.  They should all be as unique as possible.  And make liberal
          use of add_item() (which will be explained shortly).

  2. How Do I Make a Room

    The simplest of rooms looks like this:
        inherit ROOM;
        void setup() 
            set_brief("my room");
            set_long("This is a sample long description for a room.");
    You should notice the addition of 2 new functions inside the setup().


    USAGE: set_brief(string str) This is the short description of the room. set_brief("Round Room");


    USAGE: set_long(string str) This is the long description of the room. What you see when you enter the room or look in the room. A more complex version of set_long() is in the advanced section. set_long("This is a boring room.");
    Your room is pretty much boring and uselss as it stands now. This room has no exits, nothing to look at, nothing to get. The following list of functions also go inside the setup, and add more functionality to your room.


    USAGE: set_exits( mapping exits) set_exits( (["north":"/wiz/rust/area/room1", "south" : "/wiz/rust/area/room2", "southeast" : "/wiz/rust/area/room3" ]) ); This will place the exits north, south and southeast into your room with the destinations as room1, room2, room3 respectively. ** Please note that using full paths like /wiz/rust/... anywhere in your ** file, while it will work is not acceptable. When we move your area to ** the /domains directory in the game if you have put the full path of ** everything in every room/monster we now need to update every file ** in order to move them. ** ** See the help on '
    Using an include file.'


    USAGE: add_item(string array str...) add_item( "walls","wall","The walls here while serving there purpose " "of holding the ceiling up, serve no other " "useful purpose" ); The above is add_item in its simplest form, What this does is add some depth to your rooms. The above will create allow a player to type look at walls, look at wall, and see the description "the walls...." as if the object was really in the room. These should be used OFTEN in your rooms basically for every noun you have you should have an add_item for it. In the above example the last argument if a string is the long description. All but the last argument are considered as 'ids'. There is a more complex version of add_item, that adds even more depth to the room, and allows interaction with any of the 'verbs' the mud currently has. *** Note that this is not an ideal solution other than for very *** basic verb interactions. If you want to do really complex things *** please read the help for creating
    Coding Objects add_item("mountains","mountain","hill", ([ "adjs" : "steep", // Can also use an array... "look" : "They are too steep to climb.", "climb" : "They are too steep to climb." ]) ); Again all the arguments passed to add_item except the last one are considered id's. So your players could look at mountains/mountain/hill The last argument in this case is a mapping. This allows you to set up the item to respond to particular verbs that a player types, and to give the item adjectives as well. In the above example that player could type look at mountain, look at steep mountain, look at steep hill, climb mountain, climb steep mountain etc. Again this should be used with caution as its very basic interaction.


    USAGE: set_objects(mapping stuff); set_objects( ([ "/wiz/rust/monters/grue" : 1, "/wiz/rust/monters/URgrue" : 2 ]) ); This function allows you to make a certain number of objects available in the room after each reset(). The above example will make sure that there are 1 grue and 2 ur-grues in the room after reset(). You do not have to worry about what happens at reset time, the mudlib automatically handles the resetting of your monsters. set_objects() actually takes a differant argument from the value as well if you need to pass arguments into the setup() of the object you want in the room (doors are a good example) you need to pass an array as the value for example: set_objects( ([ "path1" : ({ X, arg1, arg2, arg3 }) ]) ); In the above example X = the number to clone in the room (and reset), arg1, arg2 are passed to setup() of the object specified by path1. *** Note that we discourage the use of full paths anywhere, either *** use relative paths, or use an
    include file to define the paths.


    USAGE: set_light(int i) This function allows you to have your room be light or dark. By defualt rooms are dark. set_light(1); -- or -- set_light(0);


    USAGE: set_weather(int i) This function is set to allow the use weather outdoors. This must be set on all outdoor rooms so guilds such as Druids can use there abilitys. Set this as (1) for outdoors. We also now have an OUTDOOR_ROOM that can be used instead of inheriting ROOM, it sets the weather for you. set_weather(1); -- or -- set_weather(0);


    USAGE: set_water(int i) This sets if there is water in your room. races that are alergic to water will take damage when entering this room. This actually clones /std/puddle.c and moves it to the room. Set 1 if small amount of water, 2 if its a spray and 3 if it is underwater room.
  3. Advanced Features


    USAGE: set_reset_location(string str) If this is set to a valid room, When players reconnect from link death in this room they will be moved to the room you specified. Most often used to stop players from going link dead in a 'treause room' then returning in an hour to get the treasure again after it resets. set_reset_location("room")


    USAGE: set_no_teleport() This sets whether or not players are allowed to teleport into and teleport from this particular room.


    USAGE: set_no_shelter(); This sets whether or not a player may cast the spell shelter in this particular room.


    USAGE: set_no_spells(); This sets whether or not a player may cast any spells in this room


    USAGE: set_no_skills(); This sets whether or not a player may use any skills in this room


    USAGE: set_no_kill(); This sets whether or not any killing may happen in this room. Setting this also forcess set_no_spells(), and set_no_skills() to be set.


    USAGE: set_no_warp(); This disables the use of the 'warp' by newbies. The primary reason for this is to disallow them from getting out of places like the gauntlet/arena, or a free way out of players castles.


    USAGE: set_no_track(); This sets whether or not players/monsters leave tracks in this room. All players and all monsters by default when moving through rooms leave tracks in the room for a short period of time.


    USAGE: set_state_description(string str, string description); This allows you to set specific descriptions in your room for certain things. In order to make use of this feature you also have to do the following in your set_long (note the $flame). set_long( "A large chest glows softly as it sits against a wall of this " "small, dusty attic. Set into the wall above the chest is a brass " "dish, $flame. A flight of stairs " "plunge steeply down to the Grand Hall below." ); State variables have 2 states, they are either on or off. In the below 2 lines we define a description for flame_on, and flame_off. These will be used in the long desc to replace $flame depending on whether or not the state is on or off (kind of confusing as its the 'flame' object that tells the room to change the state of flame) set_state_description("flame_on","in which burns a magical blue flame"); set_state_description("flame_off","which is currently dark"); The next line tells the room to start with a state of 'flame_off' so this description will be used when the room is initially loaded. set_room_state("flame_off"); for example: > look [ /domains/examples/rooms/state_room ] Attic [exits: ] A large chest glows softly as it sits against a wall of this small, dusty attic. Set into the wall above the chest is a brass dish, which is currently dark. A flight of stairs plunge steeply down to the Grand Hall below. *** note the desc 'which is currently dark' was substituted for $flame >light dish You light a small dish. > look [ /domains/examples/rooms/state_room ] Attic [exits: ] A large chest glows softly as it sits against a wall of this small, dusty attic. Set into the wall above the chest is a brass dish, in which burns a magical blue flame. A flight of stairs plunge steeply down to the Grand Hall below. *** note the desc changed to the flame_on description. Again this means the *** flame/dish object has to talk to the room, but it makes your room desc *** much more interesting.


    USAGE: set_default_exit(string str) The argument to this should be a string or a function pointer that returns a string. This string will be displayed to the player if they try to use an exit that doesnt exist in the room.


    USAGE: set_hidden_exits(string array str...) This takes a list of exits ( "east","west" ). These exits will NOT be displayed in the exits line of the room.


    USAGE: set_enter_msg(string str); This will replace the default message that is displayed when a player enters this room.


    USAGE: set_exit_msg(string str); This will replace the default message that is displayed when a player exits this room.


    USAGE: set_long(function foo) Set long can also take a function pointer as an argument so that it can do customizable long descriptions. This function pointer must return a string. Example: set_long(( :my_long:) ); In my room I then do: string my_long() { whatever code to generate the desc here return desc; } Every time the player types look in this room, the long description will be dynimcally generated.


    USAGE: add_hook(string str, function func) There are a series of hooks that are called in the room, that you may use to allow/disallow certain actions in the room. for example if its a newbie area you can stop higher level players from entering. See the help on hooks Hooks are really nothing more then functions being called by the mudlib. For example every time a player/monster/object enters the room the code that does that move tries to call the 'object arrived' hook. If you didnt define that hook then nothing happens, however if you did the following: add_hook("object_arrived", (: my_func :) ); my_func will be called in your room with an argument of the player/monster/object that has moved into the room.
  4. Example Rooms

       inherit ROOM;
       void setup()
          set_long("This is an example room. Here "
                   "is where the long description would go." );
          set_brief("Example room");
          set_exits( ([ "north" : path1,
                        "east" : path2
                    ]) );
          set_objects( ([ "path1" : 3 ]));
    inherit ROOM; /* called whenever a person enters the room, based on the add_hook below. */ void check_for_zifnab(object what) { /* only sends the message if its zifnab */ if (what->query_userid() == "zifnab") { what->my_action("Blah"); } } void setup() { set_long("This is an example room. Here " "is where the long description would go." ); set_brief("Example room"); set_exits( ([ "north" : path1, "east" : path2 ]) ); set_objects( ([ "path1" : 3 ])); add_item("fire","flame", ([ "look" : "A red orange fire burns here keeping you warm", "touch" : "OUCH!!!! that hurt.", "enter" : "Where do you think you are going trying to enter a fire?", ]) ); set_light(1); set_no_teleport(1); set_no_shelter(); add_hook( "object_arrived", (: check_for_zifnab :) ); }