|
|
[Package Index | Mudlib Index | Effect Index]
File /std/room/basic/wall.c
This is a wall object. It is added to rooms when you use the set_wall()
function to add a climbable wall exit to a room. If you wish to have
players climb somewhere this is the preferred method to use.
See also: climb.c, /std/room.c and /std/rooftop.c
Written by Deutha Method index
- calc_co_ord()
- check_room_is_water(mixed)
This checks to see if a room (ie the bottom room) is a water room.
- fall_down(object)
This makes the object fall down the wall.
- query_aliases()
- query_at_bottom()
This determines if we are the bottom of the wall or not.
- query_belows()
This returns the array of rooms the object falls through on the way
down.
- query_bottom()
This returns the array of bottoms for the wall.
- query_death_mess()
The death message to use if the player kicks the bucket.
- query_ghost_action()
This option controls the action taken when ghosts attempt to climb.
- query_move(string)
Return the information associated with this exit.
- query_moves()
This is an array of all the moves.
- query_no_drop()
This option is used in combination with the "bottom" option.
- set_wall(mixed *)
This method sets the information related to walls.
Public Functions
These are functions that everyone can access.
-
calc_co_ord
void calc_co_ord()
-
check_room_is_water
int check_room_is_water(mixed room)
This checks to see if a room (ie the bottom room) is a water room.
-
fall_down
void fall_down(object thing)
This makes the object fall down the wall.
-
query_aliases
mapping query_aliases()
-
query_at_bottom
int query_at_bottom()
This determines if we are the bottom of the wall or not.
-
query_belows
string * query_belows()
This returns the array of rooms the object falls through on the way
down. The information variable is a string array consisting of the
locations through which something would fall on its route to the
bottom, but not including the location at the bottom. Each element
is the file name of one of these locations.
-
query_bottom
mixed * query_bottom()
This returns the array of bottoms for the wall.
There are a number of possibilities for the information variable in
this case. If it is an array containing a single string, it is the
file name of the location to which things fall. If it is an array
containing two elements, then the first element is the file name of
the location to which things fall. If the second element of this
array is also a string, then it is the name of a function which is
called on the bottom location, with arguments of what is falling and
whence it fell, and the string that the function returns is the
message (using $N and verb$s) which is present to people already at
the bottom when the falling thing arrives. If the second element is
an integer, then it is the percentage of blunt damage done to the
falling thing if it is living based on how far it fell and its total
weight.
-
query_death_mess
string query_death_mess()
The death message to use if the player kicks the bucket.
The information variable must be a string or 0.
Normally the death_mess variable (which this information variable
controls) has a value of 0, and if it's 0 when they die, the default
message of "You hit the ground with a sickening crunch.\n" is sent.
If, however, death_mess is anything else, death_mess itself will be
sent. This means that if you don't want a death message you can set
this to "". And you can make the information variable 0 if you want
the default message to be sent. Note that this is the message given
when the player falls to his death *from the room in which the
variable was set*. I.e. if a player falls to his death from a room,
and the death_mess was not set up via set_wall() in that room, they
will get the default message.
-
query_ghost_action
mixed query_ghost_action()
This option controls the action taken when ghosts attempt to climb.
It can be either 0, 1, a string containing a path, or an array
containing a string containing a path and a string array containing
three move messages.
If this is set to 0, as it is by default, the ghost will be able to
climb the wall with no skill check, succeeding every time.
If it is set to 1, the ghost will always fail, since ghosts can't
climb.
If it is set to a string, the ghost will be moved to the room whose
path is in the string, with some default messages.
If it is set to an array, the ghost will be moved to the room whose
path is in the first cell of the array. The second cell of the
array will be taken to contain a string array with the move messages
that are to be used - the first for the player, the second for the
room they are arriving in, and the third for the room they are
leaving. The move messages do not need to be terminated with
newlines.
-
query_move
mixed * query_move(string word)
Return the information associated with this exit. It will look up aliases
to determine which of the exits to point to.
- Parameters:
word - the direction to find the data for
- Returns:
the data associated with the exit
-
query_moves
mixed * query_moves()
This is an array of all the moves. THe format is ({ exit name, info, ... }).
The information variable is a mixed array consisting of four
elements. The first is a string, which is the direction, typically
"up" or "down", for the move. The second is an integer, which is the
base difficulty (to be compared against a skill bonus) for the climb
if the climber is not carrying anything. The third is a string,
being the file name of the destination location and the fourth is a
string which is the message (using $N and verb$s) which is presented
to people already in the destination location when the climber
arrives.
-
query_no_drop
int query_no_drop()
This option is used in combination with the "bottom" option. If set
to 0, which is the default, items will fall down to the bottom of
your wall. If set to 1, they won't.
-
set_wall
void set_wall(mixed * args)
This method sets the information related to walls.
All locations can have walls which can be climbed up, down or across to
reach other locations. This function can be used to set the relevant
parameters for the wall, including destinations, climbing difficulties,
climbing messages, locations below this location (locations through
which things fall if they fall from this location) the location
at the bottom (the location where things end up when they fall) and the
message they get if they are unfortunate enough to die from falling. The
elements of the mixed args array are paired, as for modify_exit, with
the first a string to indicate what information is being set and the
second a mixed variable containing the information.
As with modify_exit, more than one option can be passed to set_wall at
a time.
The indicating strings and the corresponding information variables are as follows.
It is necessary to have set_wall() in all rooms referenced by the initial
set_wall() (apparently).
- "below"
-
The information variable is a string array consisting of the locations
through which something would fall on its route to the bottom, but not
including the location at the bottom. Each element is the file name
of one of these locations.
- "bottom"
-
There are a number of possibilities for the information variable in
this case. If it is an array containing a single string, it is the
file name of the location to which things fall. If it is an array
containing two elements, then the first element is the file name of
the location to which things fall. If the second element of this
array is also a string, then it is the name of a function which is
called on the bottom location, with arguments of what is falling and
whence it fell, and the string that the function returns is the message
(using $N and verb$s) which is present to people already at the bottom
when the falling thing arrives. If the second element is an integer,
then it is the percentage of blunt damage done to the falling thing if
it is living based on how far it fell and its total weight.
- "death_mess"
-
Simple enough. The information variable must be a string or 0.
Normally the death_mess variable (which this information variable
controls) has a value of 0, and if it's 0 when they die, the default
message of "You hit the ground with a sickening crunch.\n" is sent.
If, however, death_mess is anything else, death_mess itself will be
sent. This means that if you don't want a death message you can set
this to "". And you can make the information variable 0 if you want
the default message to be sent. Note that this is the message given
when the player falls to his death *from the room in which the variable
was set*. I.e. if a player falls to his death from a room, and the
death_mess was not set up via set_wall() in that room, they will get
the default message.
- "ghost_action"
-
This option controls the action taken when ghosts attempt to climb.
It can be either 0, 1, a string containing a path, or an
array containing a string containing a path and a string array
containing three move messages.
If this is set to 0, as it is by default, the ghost will be able
to climb the wall with no skill check, succeeding every time.
If it is set to 1, the ghost will always fail, since ghosts can't
climb.
If it is set to a string, the ghost will be moved to the room whose
path is in the string, with some default messages.
If it is set to an array, the ghost will be moved to the room whose
path is in the first cell of the array. The second cell of the array
will be taken to contain a string array with the move messages that
are to be used - the first for the player, the second for the room
they are arriving in, and the third for the room they are leaving.
The move messages do not need to be terminated with newlines.
- "move"
-
The information variable is a mixed array consisting of four
elements. The first is a string, which is the direction, typically
"up" or "down", for the move. The second is an integer, which is
the base difficulty (to be compared against a skill bonus) for the
climb if the climber is not carrying anything. The third is a
string, being the file name of the destination location and the
fourth is a string which is the message (using $N and verb$s) which
is presented to people already in the destination location when the
climber arrives.
- "aliases"
-
This sets up the aliases for the exits, the variable that comes after it
in the list should be a mapping of the form: map = ([ alias : real exit, ...])
- "add aliases"
-
This adds aliases to the list of aliases, rather than just overwriting them,
like "aliases" above.
- "no_drop"
-
This option is used in combination with the "bottom" option. If
set to 0, which is the default, items will fall down to the bottom
of your wall. If set to 1, they won't.
- Example:
In wall_bottom:
set_wall( ({ "move", ({ "up", 50, PATH +"wall_side",
"$N climb$s up from below to join you." }) }) );
set_wall( ({ "no_drop", 0 }) ); /* not required */
In wall_side:
set_wall( ({ "bottom", ({ PATH +"wall_bottom", 50 }) }) );
set_wall( ({ "move", ({ "down", 50, PATH +"wall_bottom",
"$N climb$s down from above to join you." }) }) );
set_wall( ({ "move", ({ "up", 150, PATH +"wall_ledge",
"$N climb$s up from below to join you." }) }) );
set_wall( ({ "death_mess", "You splat into the pavement, "
"throwing a few guts everywhere.\n" }) );
set_wall( ({ "no_drop", 1 }) );
In wall_ledge:
set_wall( ({ "bottom", ({ PATH +"wall_bottom", 50 }),
"below", ({ PATH +"wall_side" }) }) );
set_wall( ({ "move", ({ "down", 100, PATH +"wall_side",
"$N climb$s down from above to join you." }) }) );
set_wall( ({ "death_mess", "You splat into the pavement, "
"throwing lots of guts everywhere.\n" }) );
Anywhere on the wall:
set_wall( ({ "ghost_action", 1 }) );
set_wall( ({ "ghost_action", "/w/vashti/rooms/target.c" }) );
set_wall( ({ "ghost_action", ({
"/w/vashti/rooms/target.c", ({
"You fall through the wall. Ow.",
"$N dives through the wall and rolls painfully on "
"the floor.",
"$N takes a flying leap at the wall and disappears "
"into it." }) }) }) );
|