24. DOOR SCRIPTS
There is often some confusion about what the DOOR triggers doo,
so here is a brief:
(NOTE! Door scripts can sometimes get screwed up if the Mud crashes at a
critical stage of the script, leaving a door open that really should be
closed. So loading a timered portal is usually a better option.)
%door% room.vnum direction field [value]
This command is used for adding, deleting, and modifying doors in room.
Direction determines which door is being changed, and can be north, south,
east, west, up, or down. If the door does not exist first, a new door can
be created.
Field is what property of the door is being changed. Valid fields are:
purge
Removes the door completely. Value is not used.
description
Value will be the new exit description.
flags
Value will be the new door flags. This is a list of letters representing
all the door flags.
'a' EX_ISDOOR Exit has a door that can be opened and closed.
'b' EX_CLOSED The door is closed.
'c' EX_LOCKED The door is locked.
'd' EX_PICKPROOF Lock can't be picked.
'e' EX_SECRET The door is secret.
For example,
%door% 13703 north room 13704
*creates a new exit from room 13703 to room 13704
wdoor 13703 north flags abe
*creates a closed, secret door to the north in room 13703.
%door% 13703 north flags ab
*sets the door north as closed
%door% 13703 north flags abc
*sets the door north as closed and locked
key
Value is the object number of the new key.
name
Value is the new name of the door.
room
Value is the room this door will connect to.
For example,
%door% 13703 north room 13704
*creates a new door from room 13703 to room 13704
%door% 13703 north name gate north
*sets the name of the new door
%door% 13703 north key 13704
*sets the vnum of the key to the new door
A very useful option is to identify the vnums of the room the script is
set in and the room the actor just came from. Here are the command lines
for that:
eval r %self.vnum%
eval p %actor.room%
NOTE:
To create, open and close, or in any way modify a door in a room, the
script doesn't need to be set on that room. Any script, on any room, mob
or object can be set to modify a door, if the formats above are followed.
EXAMPLE 1
TYPE IN A CODE IN ONE SEQUENCE
1) Name : code PWZ7438 ROOM
2) Intended for : rooms
3) Trigger types: Command
4) Numberic Arg : 0
5) Arguments : PWZ7438
6) Commands:
wait 1s
*CLICK!*
%echo% The door silently slides to one side.
%door% 7551 west flags a
wait 10 s
%echo% The door silently slides shut again.
%door% 7551 west flags b
EXAMPLE 2. PRESS BUTTON
1) Name : press button
2) Intended for : room
3) Trigger types: Command
4) Numberic Arg : 1
5) Arguments : press
6) Commands:
if (button/%arg%)
%echo% the panel silently slides to one side, revealing an opening in the
wall.
%door% 7552 west flags a
wait 10 s
%echo% the panel silently slides shut again.
%door% 7552 west flags b
else
%send% %actor% press what?
endif
EXAMPLE 3
TYPE IN A CODE, NUMBER BY NUMBER (not quite sure if this works!)
1) Name : open door 3674
2) Intended for : rooms
3) Trigger types: speech
4) Numberic Arg : 100
5) Arguments : *
6) Commands:
if (3/%arg%)
%echo% *click*
set HCounter 1
global HCounter
elseif (6/%arg%)
if %HCounter% == 1
%echo% *click*
set HCounter 2
global HCounter
endif
elseif (7/%arg%)
if %HCounter% == 2
%echo% *click*
set HCounter 3
global HCounter
endif
elseif (4/%arg%)
if %HCounter% == 3
%echo% *click*
set HCounter 4
global HCounter
endif
endif
if %HCounter% == 4
wait 1 s
%echo% the door silently slides to one side.
%door% 7552 west flags a
wait 10 s
%echo% the door silently slides shut again.
%door% 7552 west flags b
endif
endif
EXAMPLE 4
REMOVE THE EXIT THE ACTOR JUST WALKED THROUGH
(Entry or greet trigger)
eval r %self.vnum%
eval p %actor.room%
if %direction% == north
%door% %r% north purge
%door% %r% north description There is no exit to the north.
%door% %p% south purge
%door% %p% south description There is no exit to the south.
wait 1 s
%echo% The door silently slides shut behind you.
endif