Skip to main content

modify_exit

Discworld room help

modify_exit

modify_exit settings that require a door

Below is a list of the modify_exit settings that apply only to exits with a door installed. Settings related to locks and traps on the door are documented separately. 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.

door name

The internal reference-name of the door. A door is composed of two "door-halves", one in the current room and one in the destination room. Normally this causes no confusion because there is generally only one exit that links two rooms, however if there are two or more this internal reference name allows for disambiguation. The door name must match in the current room and the destination room.

The param is a string, it can be set to anything provided it matches with correct door in the destination room.

Notes: Only needed if more than one door exit links a pair of rooms. The name is not visible to players, for that see "door long" and "door short".

e.g.
modify_exit( "east", ({ "door name", "door_a" }) );
—> provided the matching door in the destination room has also had
the same "door name" assigned to it they will function correctly
as a pair.

door short

The short description of the door. This allows you to override the default short description, e.g. "north door". If using a multi-word description, the adjectives are automatically added for you so that "big orange door" can be referenced as "big door", "big orange door" etc.

The param is a string, it doesn't have to be the same as the short description of the matching door in the destination room, though that is usually the case.

e.g.
modify_exit( "east", ({ "door short", "large oak door" }) );
—> "You open the large oak door." when opened for instance.

door long

The long description of the door. This allows you to override the default long description, e.g. "It's just the north door.\n". This is displayed to players when they look at the door.

The param is a string, it should terminated in ".\n". It doesn't have to be the same as the long description of the matching door in the destination room, though that is usually the case.

e.g.
modify_exit( "east", ({ "door long", "This is an impressive door made "
"of oak.\n" }) );
—> "This is an impressive door made of oak."
"It is closed." when looked at.

double doors

Whether the door is composed of multiple parts and should be pluralised.

The param is an integer (1 or 0), 1 specifying that the door is composed of multiple parts and should be pluralized, 0 if it's a single door.

Note: This should be used in combination with "door short" and "door long" to provide the desired effect.

e.g.
modify_exit( "east", ({ "double doors", 1 }) );
—> The east door is considered to be made of multiple parts.
"They are closed" would be printed when closing them.

one way

Whether there isn't a door in the destination room that leads to this room. Normally a door must have a corresponding door exit in the destination room, and if none is found will generate errors on compilation. If it is deliberate that no such matching door exists this setting should be used.

The param is an integer (1 or 0), 1 specifying that there is no matching door in destination room.

Note: Because there is no corresponding door in the destination room the player will see no "You close <door>." message, you could use the "move mess" setting to send a specific message instead.

e.g.
modify_exit( "east", ({ "one way", 1 }) );
—> Specifies there is no matching door in the destination room.

other

The exit id of the door in the destination room that leads to this room. A door is composed of two "door-halves", one in the current room and one in the destination room. Normally this causes no confusion because there is generally only one exit that links two rooms, however if there are two or more this property can be set to the name of the corresponding exit in the destination room.

The param is a string, the exit name of the corresponding door in the destination room.

Note: Only needed if more than one door exit links a pair of rooms. The other id of a door is automatically setup in the force_other() function if not set already. Provided the "door name" setting for exits in both rooms has been setup correctly, this property will be set correctly too. I would recommend using "door name" instead of this setting to disambiguate parallel doors unless you have a specific need. This setting can only be set after the room is fully initialized, i.e. requires a call_out from setup().

e.g.
modify_exit( "east", ({ "other", "west" }) );
—> Specifies that the exit "west" in the destination room is the
"other side" of the east door.

stuck

Whether the door can't be opened, closed, locked or unlocked.

The param is an integer (1 or 0), 1 specifying that the door is stuck, 0 that it isn't.

e.g.
modify_exit( "east", ({ "stuck", 1 }) );
—> The east door cannot be opened, closed, locked or unlocked.

open

Whether the door is open. This setting can only be set after the room is fully initialized, i.e. requires a call_out from setup().

The param is an integer (1 or 0), 1 specifies that the door is open, 0 that it is closed.

e.g.
modify_exit( "east", ({ "open", 0 }) );
—> closes the east door (if open).

closed

Whether the door is closed. This setting can only be set after the room is fully initialized, i.e. requires a call_out from setup().

The param is an integer (1 or 0), 1 specifies that the door is closed, 0 that it is open.

e.g.
modify_exit( "east", ({ "closed", 1 }) );
—> closes the east door (if open).

open/close func

The function to call when an attempt is made to open or close the door. The function is called before the action takes place. The string "open" or "close" is supplied as the sole parameter to the function, if needed the door object can be obtained from a previous_object() call. The function should return 1 to indicate that the attempt is successful and 0 to indicate it wasn't.

The param is a two-element array, specifying the object-reference to the object where the function is defined and the function name.

e.g.
modify_exit( "east", ({ "open/close func",
({ this_object(), "func" })
}) );
—> The east door can be opened but not shut.

Function signature :-
int door_open_func(string open) {
if (open == "open") { return 1; }
return 0; // open == "close"
}

secret

Set the player perception bonus required for the door to be visible. This does not remove the door automatically from the list of obvious exits strangely enough, so you may well want to do that separately. One possibility is to make the exit obvious at the same time it becomes visible by modify_exit( "east", ({ "obvious", "func" }) ); and then have that func return 1 if ( this_player()->query_skill_bonus( "adventuring.perception" ) > required_bonus ), where the required bonus matches whatever bonus you've set for the "secret" setting.

The param is an integer, the perception bonus.

e.g.
modify_exit( "east", ({ "secret", 400 }) );
—> The east door is not visible (e.g. via "look doors") unless the
player has a bonus of 400 or greater in perception.

transparent

Whether the door can be seen through when closed. Exits of type "window" are transparent by default.

The param is an integer (1 or 0), 1 specifies that the door can be seen through, 0 that it can't.

e.g.
modify_exit( "east", ({ "transparent", 1 }) );
—> The east door is transparent, allowing a player to look at the
room beyond even when closed.

undoor

A call to remove an existing door from an exit. If a "The destination room does not have a door coming back here." Error is to be avoided, the setting must be set after the room is fully initialized, i.e. requires a call_out from setup().

Note: This only removes the door object from the exit, not the exit itself. This only removes the door in this room, not in the destination room, it doesn't even set that door to "one way".

The param is not used, but you should still provide one.

e.g.
modify_exit( "east", ({ "undoor", "param ignored" }) );
—> The east exit no longer has a door in this room.

Other modify_exit Types

Detail on each of the other modify_exit types along with examples are available in :-

help modify_exit_exitsSettings that apply to any exit.
help modify_exit_locksSettings that are related to locks on doors.
help modify_exit_trapsSettings that are related to traps on doors.

See also

add_exit, remove_exit, modify_exit