modify_exit |
Discworld room help |
modify_exit |
modify_exit settings that apply to any exit
Below is a list of every modify_exit setting that applies to any exit, regardless of whether that exit is a path, door, has a lock or trap. Each setting is described in detail, with additional notes if necessary and an example of how the setting is used. Where callback functions are used by the setting, the required signature for the function is shown.
dest
The room that the exit leads to.
The param should be the path of the destination room without the trailing ".c".
e.g.
modify_exit( "east", ({ "dest", "/d/am/streets/brewer/brewer01" }) );
—> A player leaving the room through the east exit will arrive at the
destination room defined in "/d/am/streets/brewer/brewer01.c"
size
The physical size of the exit. The size of an exit is used by various items around the mud to see if they can fit through the exit. Mostly it was intended for use by things like horses, so you can't walk your horse around inside a house or a tight corridor. As example values, the exits inside the mended drum are 300, the road outside is 1300.
The param is an integer specifying the size of the exit.
e.g.
modify_exit( "east", ({ "size", 300 }) );
—> The east exit size is set to 300 (standard interior size).
obvious
Whether the exit is included in the list of obvious exits.
The param should be either an integer (1 for inclusion, 0 for exclusion) or a function. A function is supplied either as a string specifying the name of the function defined in the room, or as an array specifying the path or object-reference to the object where the function is defined and the function name. Where a function is used it should return 1 or 0.
e.g.
modify_exit( "east", ({ "obvious", 0 }) );
modify_exit( "east", ({ "obvious", "is_obv" }) );
modify_exit( "east", ({ "obvious", ({ "/d/some/path", "is_obv" }) }) );
modify_exit( "east", ({ "obvious", ({ this_object(), "is_obv" }) }) );
—> The east exit will be exluded from the obvious exit list.
function signature :-
int is_obv(string exit) {
return 0;
}
relative
Whether the exit is displayed as a relative direction. A relative direction exit changes label depending on the direction of the observer, e.g. "forward". The exit can also only be selected by players using relative direction commands.
The param should be an integer (1 or 0). A value of 1 specifies the exit should be relative, 0 if not.
e.g.
modify_exit( "east", ({ "relative", 1 }) );
—> The east exit can only be navigated using the relative direcion.
relative nice
Whether the exit is displayed as a relative direction but still responds to compass directions. A relative nice direction exit changes label depending on the direction of the observer, e.g. "forward".
The param should be an integer (1 or 0). A value of 1 specifies the exit should be relative nice, 0 if not.
e.g.
modify_exit( "east", ({ "relative nice", 1 }) );
—> The east exit can be navigated using both the relative direction
and "east".
no follow
Whether NPCs are prevented from following a person through the exit.
The param should be an integer (1 to prevent NPCs following, 0 to allow).
e.g.
modify_exit( "east", ({ "no follow", 1 }) );
—> NPCs are prevented from following through the east exit.
function
The function to call when a person attempts to leave through the exit. The function is called before the move takes place and should return 1 or 0, where 1 indicates that the move is permitted, 0 if no not. If returning 0, notify_fail(string) can be used to print a failure message to the player.
The param is a function, supplied either as a string specifying the name of the function defined in the room, as an array specifying the path or object-reference to the object where the function is defined and the function name, or a function pointer. When supplied as an array, additional parameters can be to be passed to the function in the third and successive elements of that array.
e.g.
modify_exit( "east", ({ "function", "func"}));
modify_exit( "east", ({ "function", ({"/d/some/path", "func"}) }) );
modify_exit( "east", ({ "function", ({this_object(), "func", "?"}) }) );
modify_exit( "east", ({ "function", (: func :) }) );
—> The player is permitted to move.
Function signature :-
/* I've no idea what the special parameter is for, it's always 0
* afaik. The *args parameter is only supplied if the function is
* specified using an array with more than the minimum two members
* for the function's object and function name, such as in the third
* example. Any additional values are supplied as the *args array
* paramter.
*
* In most cases the following signature is sufficient:-
* int func( string exit, object thing )
*/
int func( string exit, object thing, string special, mixed *args ) {
return 1; // allow all moves.
}
look func
The function to call when a person attempts to look through the exit. The function is called before a player glances or looks through the exit and should return 1 or 0 where 0 indicates the default output should be printed and 1 means it shouldn't. You can distinguish between look and glance by using the flag parameter to the function with 0 indicating glance and 1 indicating look. The exit is not passed to the function so for rooms with multiple exits you must define a function for each.
The "look func" and "look" properties can both be defined for an exit, if so "look" is evaluated first for the output to be printed to the viewer, then the function defined in "look func" is called afterwards.
The param is a function, supplied either as an array specifying the path or object-reference to the object where the function is defined and the function name, or a function pointer.
e.g.
modify_exit( "east", ({ "look func", ({"/d/some/path", "func"}) }) );
modify_exit( "east", ({ "look func", ({this_object(), "func"}) }) );
modify_exit( "east", ({ "look func", (: func :) }) );
—> The short or long room description of the room to the east depending
which of glance or look the player used.
Function signature :-
/* The flag parameter indicates if the player performed a look or a glance.
* 0 - glance
* 1 - look
*/
int func( int flag ) {
return 0; //Show the player the destination room as normal.
}
look
The message printed to a person looking through the exit. This message will replace the output that the viewer would normally see. No trailing '\n' is required and no $ expansion is performed on the message. You can distinguish between look and glance by using the previous_command(1) path and checking which command was used.
The "look func" and "look" properties can both be defined for an exit, if so "look" is evaluated first for the output to be printed to the viewer, then the function defined in "look func" is called afterwards.
The param is either a string constant or a function pointer.
e.g.
modify_exit( "east", ({ "look", "You can't see through there." }) );
—> "You can't see through there."
modify_exit( "east", ({ "look", (: func :) }) );
—> "Don't be so nosy."
Function signature :-
string func() {
return "Don't be so nosy.";
}
exit mess
The message printed to the room when a person leaves through the exit. Message $ expansion is performed (see section below): $N, $T, $r, $o $p are supported along with $s and $V0=<string>,<string>$V$ for pluralisation. No trailing '\n' is required. The string should have a $N in it somewhere (which will be replaced by the name(s) of those exiting), eg. "$N womble$s carefully through the tight hole.".
The param is either a string constant or a function pointer. If using a function, the thing that is passing out through the exit is supplied as a parameter.
e.g.
modify_exit( "east", ({ "exit mess",
"$N head$s out $T, $r sigh$s while shaking $p $V$0=head,heads$V$ "
"and tutting to $oself." }) );
—> "Harry heads out east, he sighs while shaking his head and tutting "
"to himself."
modify_exit( "east", ({ "exit mess", (: query_exit_mess :) }) );
—> "Harry leaves."
Function signature :-
string query_exit_mess(object thing) {
return "$N leaves.";
}
enter mess
The message printed to the destination room when a person leaves through the exit. Message $ expansion is performed (see section below): $N, $F (only if using string param), $r, $o $p are supported along with $s and $V0=<string>,<string>$V$ for pluralisation. No trailing '\n' is required. The string should have a $N in it somewhere (which will be replaced by the name(s) of those exiting), eg. "$N womble$s carefully through the tight hole.".
The param is usually either a string constant or a function pointer. If using a function, the thing that is passing out through the exit is supplied as a parameter. Both string and function params form the entire print-output and ignore the player's msgin.
An array can also be supplied as the param, the first element should be 0 or 1 and the 2nd element should be a string. No $F expansion is performed on the string but it will become the value for any further $F expansion. If the first element is 1, the string of the 2nd element is printed to the destination room but without $F expansion, unless you have a very specific need use a string param instead. If the first element is 0 then all occurences of $F in the person' msgin are replaced with the string in the 2nd element, that is then printed to the destination room. This is the way to override the default opposite-direction of an exit, a player by default has an msgin of "$N arrive$s from $F.", so setting the param to ({ 0, "inside the rabbit hole" }) will result in "Mr Player arrives from inside the rabbit hole.".
Note on $F expansion: - It'll work as long as the existing param is an array (the default state) and you supply the param as a string, otherwise an actual $F is printed to players. If you're only modifying this type once to a string on setup then it should work fine, but if the type is changed multiple times it is best to avoid including $F in your messages and specify it yourself.
e.g.
modify_exit( "east", ({ "enter mess",
"$N enter$s from $F, $r sigh$s while shaking $p $V$0=head,heads$V$ "
"and tutting to $oself." }) );
—> "Harry enters from the west, he sighs while shaking his head and "
"tutting to himself."
modify_exit( "east", ({ "enter mess", (: query_enter_mess :) }) );
—> "Harry enters."
modify_exit( "east", ({ ({ "0", "the kitchen" }) }) ); // Note no '.'
—> "Harry arrives from the kitchen."
modify_exit( "east", ({ ({ "1", "$N stumbles in." }) }) ); // Use a string!
—> "Harry stumbles in."
Function signature :-
string query_enter_mess(object thing) {
return "$N enters.";
}
move mess
The message printed to the person when moving through the exit. No messsage $ expansion is performed.
The param may be a string or a function pointer, it should end with a '\n'
e.g.
modify_exit( "east", ({ "move mess",
"You feel a cold breeze as you pass through the archway.\n"
}) );
—> "You feel a cold breeze as you pass through the archway."
modify_exit( "east", ({ "move mess", (: query_move_mess :) }) );
—> "You feel a cold breeze as you pass through the archway."
Function signature :-
string query_move_mess( object thing ) {
if ( thing->query_property("dead") )
return "You waft through the archway.\n";
else
return "You feel a cold breeze as you pass through the archway.\n";
}
follow mess
The message printed to someone following a person through the exit. The message should be of the form to fit "You follow Mr Tulip <message>.\n".
The param is a string, no trailing '.' or '\n' is required.
e.g.
modify_exit( "east", ({ "follow mess", "up the flight of steps" }) );
—> "You follow Harry up the flight of steps."
linker mess
The exit and enter room messages for the linker for the exit. This is useful when an exit leads off the linked area (such as a village square), the destination room isn't linked but you'd like linker messages when people use the exit anyway. Message $ expansion is performed (see section below): $A, $D, $N, $P, $T, $o, $p, $r expansions are supported along with $s and $V0=<string>,<string>$V$ for pluralisation.
Note: The dynamic preposition, static preposition and area name are defined when using the set_linker(rooms, dynamic, static, area) call on the room. In general it is easier to just use $N and specify the actual text, as in the second element of the array in the example below.
The param is an array of two strings, the first of which is an exiting message and the second of which is an entering message. They are the messages given to the linked area when someone uses that exit. Marketplaces and such should provide examples of this for exits to non-linked areas e.g. stalls.
e.g.
modify_exit("east", ({ "linker mess", ({
"$S $A, $N move$s $D $P the gravel path.\n",
"$N enter$s the square from the east.\n" }) }) );
—> "On the square, Harry moves east onto the gravel path."
—> "Harry enters the square from the east."
delta
The relative x,y,z position delta of the destination room. This can be used to override the calculation of room coordinates from the room size, or to enable coordinate calculation for non-compass exits (eg, "out"). Note that the adjoining room must have a complementary delta for its exit to this room.
The param is a three element integer array specifying the x, y & z ( west->east, south->north & down->up ) distances to the destination room.
e.g.
modify_exit( "out", ({ "delta", ({ 100, 150, -50 }) }) );
—> The center of the out exit's destination room is placed 100 feet
east, 150 feet north and 50 feet down from the center of the
current room.
upgrade
The vertical distance up to the destination room. This can be used to override the calculation of the room coordinates from the room size for the vertical (down->up) distance.
The param is a single integer specifying the z-azis (down->up) distance to the destination room.
e.g.
modify_exit( "out", ({ "upgrade", 200 }) );
—> The center of the out-exit's destination room is placed 200 feet
above the center of the current room.
downgrade
The vertical distance down to the destination room. This can be used to override the calculation of the room coordinates from the room size for the vertical (up->down) distance.
The param is a single integer specifying the negative z-axis (up->down) distance to the destination room.
e.g.
modify_exit( "out", ({ "downgrade", 150 }) );
—> The center of the out-exit's destination room is placed 150 feet
below the center of the current room.
no map
Whether the exit should be excluded from maps and players prevented from looking through it.
The param is a single integer 1, or 0. The value 1 specifies that this exit should be exluded from maps and that players should be prevented from looking through it. A value of 0 specifies that the exit should be included in maps and players allowed to look through it.
e.g.
modify_exit( "east", ({ "no map", 1 }) );
—> The east exit is excluded from maps and cannot be looked through.
Other modify_exit Types
Detail on each of the other modify_exit types along with examples are available in :-
help modify_exit_doors | Settings that require a door type exit. | |
help modify_exit_locks | Settings that are related to locks on doors. | |
help modify_exit_traps | Settings that are related to traps on doors. |
Message $ Expansion
The following list covers all $ expansions, check the detailed information for the type to see which it supports.
$A | the area name of the room. | |
$D | the direction of the exit. | |
$F | the opposite direction of the exit which the player leaves through. E.g. the player leaves through the "North" exit, $F will be "the South", other standard opposites are defined in /obj/handlers/room_handler, where no standard opposite is known, "elsewhere" is used. | |
$N | The player's name, might be coloured as per options depending on the setting. | |
$P | the dynamic preposition, this is used when someone enters/exits the room, the default is "into". | |
$S | the static preposition, this is used when someone says something in the room, the default is "in". | |
$T | the name of the exit the player leaves through. | |
$o | query_objective() - him/her/it, or them when two or more objects move at once. Also himself/herself/itself, or themselves. | |
$p | query_possessive() - his/her/its, or their for two or more objects. | |
$r | query_pronoun() - he/she/it, or they when two or more objects move at once. | |
$s | pluralisation helper. | |
$V$0=<s>,<p>$V$ | more complex pluralisation helper where $s isn't sufficient, <s> = singluar, <p> = plural. |
Message $ Expansion Examples
$N climb$s out of the hole and dust$s the dirt off $p clothes.
-> Taffyd climbs out of the hole and dusts the dirt off his clothes.
-> Taffyd and Womble climb out of the hole and dust dirt off their clothes.
$N fall$s from the sky, landing awkwardly on $p $V$0=leg,legs$V$ before picking $oself up.
-> Taffyd falls from the sky, landing awkwardly on his leg before picking himself up.
-> Taffyd and Womble fall from the sky, landing awkward on their legs before picking themselves up.