/
lib/banish/
lib/d/
lib/doc/
lib/doc/domains/
lib/doc/efun/
lib/doc/examples/
lib/doc/examples/armour/
lib/doc/examples/contain/
lib/doc/examples/food/
lib/doc/examples/magic/
lib/doc/examples/monster/
lib/doc/examples/room/
lib/doc/examples/weapons/
lib/function/
lib/include/
lib/include/fn_specs/
lib/include/skills/
lib/info/
lib/inherit/base/
lib/log/
lib/manuals/312/
lib/news/
lib/obj/party/
lib/objects/components/
lib/open/
lib/open/library/
lib/open/party/
lib/players/
lib/players/zilanthius/
lib/room/
lib/room/city/arena/
lib/room/city/creator/
lib/room/city/garden/monst/
lib/room/city/obj/
lib/room/city/shop/
lib/room/death/
lib/room/registry/
lib/secure/
lib/secure/UDP_CMD_DIR/
lib/skills/
lib/skills/fighter/
lib/skills/thief/
lib/usr/
lib/usr/creators/
lib/usr/players/
               -=[ Making a Door ]=-

Doors are complex little beasties.  They have to be able to keep a common status
between two rooms, and have a fairly large complement of actions for an item
that is not used often.  However, they are the bane of players, and the nitty
gritty of the thief skill. 

Because you have to key in the muds thief skills then it is recommended that you
use the door that is available in inherit/room2.  It is relatively user friendly
and has many useful features.  If there any improvements you feel should be done
then please mail me (Zilanthius).  To add a new door to a room, you use
load_door().  Each time you call load_door() a new door is added. However, you
have to load the reverse room at the destination file (if you want one).  It has
a format similar to load_spell() (see spell2.doc).  I find this format
friendlier when dealing with long argument lists for a function. 

Example:

inherit "inherit/room2";

void reset(status arg) {
  reset_doors(0);  /* <<<< IMPORTANT to reset door <<<<< */
  if(arg) return;
  set_short("test room");
  set_long("This is a test room.\n");
  set_weather(1,0,0);
  load_door(({
    "destination",       "players/zil/workroom",
    "direction",         "gate",
    "closed",            /* "open",      alternative     */            
    "description",       "The gate is made of iron bars.\n"+
                         "Hanging on the side is a small padlock.\n",
    "key id",            "round key", /* "no_key" is a special keyword ;) */
    "locked",            /* "unlocked",  alternative */
    "lock difficulty",   5,
    "lock id",           "padlock",
    "lock description",  "The padlock has a round key hole.\n",
    "trap description",  "You detect a needle trap.\n",
    "trap damage",       5,
    "trap message",      "A small needle pricks you.\n",
    "trap message room", "A small needle pricks @@query_name:$this_player()$"+
                         "@@.\n",
/* other options...
    "secret door",       compare_intelligence_value,
    "door number",       number_matched_in_exit_room,
 */
  }));
}

Note: All attributes are optional except for "destination". Thus 
load_door(({ "destination", "players/zil/workroom", })); will default to
an open door with no lock or trap.


Note: "door number" is a method of matching doors between two rooms.  The door
routine matches the filenames of both rooms.  However, if you have multiple
doors in one room leading to the same room, it will only match the first door
with a destination matching the exit room. To circumvent this, you can add a
door matching number. Thus you can have 3 doors in rooma that lead to roomb,
with door numbers 0,1,2. If you only have 1 door, then the default is 0.

Note: reset_doors(0) resets the door flags each reset. If an arg of 1 is used
the finders of secret doors will also reset.

related functions:
  query_door_attribute(string door_id, string attribute)
  set_door_attribute(string door_id,string attribute,mixed argument);



door.h is now redundant as door code has been added to room2. door.h and its fn
make_doors() is now a socket between the old door.h and the new doors. The new
door functions are a little more consistent with thief skills. Bash has been
removed as opening doors without a key, is the realm of the thief ;) 

make_doors() is used by a "master" room, which makes "slave" doors in the
destination rooms. If the master room is updated all slave rooms are updated.
However, when a slave room is updated the master room has no way of knowing
this, and the reverse door exit is lost. The door is recovered when make_doors()
is called again in the master room. Normally, at the next reset(1).

For this reason it is recommended that you don't use this function. Use   
load_door() instead.  Load a door to exit to the appropriate destination, and in
the destination room load the reverse door. Thus updating the room will not
loose the exit.


Example of old way (redundant):

inherit "inherit/room2";
#include <door.h>

void reset(status arg) {
  make_doors("players/zil/rooma", "north door",
             "players/zil/roomb", "south door",
             "The lock needs a round key.\n",
             "round key",
             "The door is made of timber.\n",
             1,1,0);
  if(arg) return;
  set_short("test2");
  set_long("This is test room 2.\n");
  set_weather(2,0,0);
}