Room Properties(4) LPC LOCAL FUNCTIONS Room Properties(4)
NAME
Room Properties - common properties in the room object
SYNOPSIS
set ( <property>, <value> ) ;
DESCRIPTION
Rooms use the common object properties short, long, and
light. In addition, they also use the following special
properties:
exits
A mapping whose keys are the directions the player can
go and whose values are the filenames of the rooms the
exit takes him to. For example:
set ("exits", ([ "north" : "/d/TMI/partyroom.c" ]) ) ;
would give the room one exit, north, which would take
the player to the party room in the TMI domain. One can
also use:
add ("exits", ([ "south" : "/d/TMI/drunktank.c" ]) ) ;
which would add a new exit to the existing ones. One
can also use:
remove ("exits/south") ;
which would remove the south exit.
item_desc
A mapping whose keys are the names of things mentioned
in the room description and whose values are string to
be returned if the player looks at those things. This
makes it possible to give descriptions to items in the
room without having to clone up actual objects. For
example, suppose the room did:
set ("long", "This is a room with a single chair in the
middle") ;
set ("item_desc", ([ "chair" : "This chair is very
rickety and would collapse if you sat in it." ]) ) ;
Then, if a player entered the room and typed "look at
chair", he would see the description of the chair, even
though there is not an actual chair object in the room.
item_func
A mapping whose keys are the names of things mentioned
Page 1 (printed 11/25/92)
Room Properties(4) LPC LOCAL FUNCTIONS Room Properties(4)
in the room description and whose values are functions
to be called if the player looks at the item. For
example, one can create the famous painting portal by
doing this:
set ("item_func", ([ "painting", "teleport" ]) ) ;
int teleport() {
// code to move the player to another room
and then, if a player enters the room and types "look
at painting", the function teleport will be called and
the player will be bamfed to wherever to code sends
him. There are many other possible creative uses for
this property.
objects
A mapping whose keys are the ids of objects and whose
values are the filenames of those objects. When the
room is reset, any object in the objects property which
is not present will be cloned and moved to the room.
This avoids having to manually write a lot of reset
procedures in your rooms. For example, a room
containing this code:
set ("objects", ([ "orc" : "/obj/orc", "chair 2" :
"/obj/chair", "chair 2" : "/obj/chair" ]) ) ;
will, at reset time, bring the contents of the room up
to one orc and two chairs, cloning new items as needed
to make that happen.
pre_exit_func
A mapping whose keys are the directions that a player
can exit the room and whose values are functions that
will be called in the room just before the player
leaves. For example, if the room code contains:
set ("pre_exit_message", ([ "north" : "foo" ]) ) ;
then whenever a player left the room via the north
exit, the function foo would be called just BEFORE the
player left the room.
If the function returns 1, then the player will not be
allowed to leave the room.
post_exit_func
A mapping whose keys are directions and whose values
are functions to be called just AFTER the player leaves
the room. The only difference between pre_exit_func and
post_exit_func is that the moving player is in the room
sent to the leaving player.
exit_msg
A mapping which allows you to supersede the usual "Fred
Page 2 (printed 11/25/92)
Room Properties(4) LPC LOCAL FUNCTIONS Room Properties(4)
leaves east" message with a special message for that
room. For example, if you had a room full of mirrors,
you might:
set ("exit_msg", ([ "north" : "$N leaves, but the
mirrors make it impossible to know what direction he
went.0) ;
then that message would be displayed whenever the
player went north. If there is no exit_msg for a
direction, then the default message is used, either "$N
leaves $D" for a player or a wizard's custom message.
Page 3 (printed 11/25/92)