Valarin
DGScripts: Script Commands
S C R I P T   S P E C I F I C   C O M M A N D S
* text
An '*' at the beginning of a line is a comment. The rest of the line is ignored.
global variable
Global changes variable into a static variable.
eval variable expression
Eval evaluates expression and sets variable to result. See section 7 for details on how expression evaluation works.
Example: eval foobar 15 - 5
sets the variable foobar to the value 10
break
Terminate a series of commands associated with a particular case in a switch block. If break is not used before the next case, the commands for the next case will be executed as well. See switch and its example for a better understanding.
case condition
Defines an element within a switch block. See switch below.
default
Used in a switch block; if none of the case conditions have been met, the default set of commands will run. See the switch example for a better understanding.
done
Terminate a switch or while block. See below.
if (expression)
...
elseif (expression)
...
else
...
end
An 'if' must occur before the other three. If expression evaluates to true (see the Expressions for more detail on expression evaluation), the statements between the if statement and the next elseif, else, or end are executed. If it stopped at an elseif or else, it scans for the next end, and continues execution at that point. If the expression evaluated to false, it searches for the next elseif, else, or end. If it finds an elseif, it checks that expression. If it is true, it executes the statements between the elseif and the next elseif, else, or end, and then finds the end of the block. If it is false, it continues searching in the same pattern, until a true elseif is found, an else is found, or an end is found.
halt
Halt ends the trigger execution.
return value
Return sets the return value of the trigger. Normally, a script will return 1, unless another return value is specified with the return command. Unlike most computer languages, the return command does not end the trigger's execution. The value is returned after all the commands have been executed, or a wait or halt command is called.
set variable value
Set sets variable to value, without evaluating it.
Example: set foobar 15 - 5
sets the variable foobar to the string "15 - 5"
switch expression
This begins a conditional block that differs from if in the level of complexity. An if block has one or two conditions which have commands executed (one set of commands for "if this is true" and possibly another set for "otherwise" (else)). When the possibilities for blocks of commands exceed two cases, either additional if blocks are needed, or a switch is needed. An example is shown here:
* First pick a number between 1 and 3
eval number %random.3%
* Then do something based on the chosen number
switch %number%
case 3
say the number is three
break
case 2
say the number is two
break
default
say the number must be 1, since it is constrained between
1 and 3, and it was not 3 or 2.
break
done

unset variable
Unset eliminates the specified variable if it exists.
wait duration
wait until time
A wait command causes the trigger to pause for a certain length of time. If just a numerical argument is given, the pause will be for that many of pulses (currently 0.1 seconds). If the number is followed by an 's', the pause will be in real life seconds. If the number is followed by a 't', the pause will be in tics (game hours). If wait until is used, the trigger is paused until time. Time may be of the form HH:MM or HHMM (e.g. 14:30 or 1430).
while expression
This starts a loop block. The block contains a series of commands which will execute repeatedly until the expression is false. The block is terminated with a done statement. The done statement causes the expression used in the while line to be re-evaluated and, if it is false, the loop breaks.
G A M E   C O M M A N D S

Normal game commands can be used in triggers. Each type of game object has a separate set of commands available to it.

M O B   C O M M A N D S

Mobs can use any game command available to a mortal player character of the same class and level as the mob. In addition, they can use the following special commands.

 

masound message
Masound echoes message to the all the rooms the exits of the mob's room lead to.
mat target command
The command is performed by the mob at the specified target. The target may be a room number, character name, or object name. The target room can not be a private or god room. Valid commands are any commands usable by a mob.
mecho message
Mecho sends message to everyone awake in the same room as the mob.
mechoaround victim message
This sends message to everyone in the room except for victim and the mob.
mexp victim amount
Mexp changes the victim's experience points by amount. The amount may be 100,000 exp and less, including negative values.
mforce victim command
The mob forces victim to perform the command. If victim is 'all', all the characters in the room are forced to perform the command. Immortals are not affected by this command. No message is sent to the character, except what is caused by the command performed.
mgoto target
This command moves the mob to the given target. The target may be an object, room, or character, as long as it is not in a private occupied with two or more characters, or god room. No message is given.
mjunk object
The object in the mob's inventory specified is removed from the game. 'Mjunk all' removes all of the objects in the mob's inventory. No message is sent by this command.
mkill victim
Mkill causes the mob to hit the victim. It is the same as kill, except mkill works for low level mobs attacking PCs, where kill does not.
mload <obj|mob> vnum
This command loads a mob or object into the game. Mobs are loaded in the same room as the mob using the command. No-take objects are loaded into the mob's room, and all other objects are loaded into the mob's inventory. The object or mob's vnum must be specified; the name will not work. No message is given.
mpurge [target]
Mpurge removes objects or mobs from the game. If no argument is given, then all objects and mobs in the room will be removed. If there is an argument, only that mob or object will be purged. PCs can not be purged with this command. There is no message when this command is used.
msend victim message
The victim of msend gets the message.
msilent command
placed in front of any other command, msilent prevents this command from outputting any text.
mteleport victim target
Mteleport moves the victim to the target. The victim does not need to be in the same room as the mob. If the victim is 'all', all the characters in the room will be teleported to the target room. No messages are generated by this command.
O B J E C T   C O M M A N D S

Items can use the following commands.

 

oat target command
The command is performed by the object at the specified target. The target may be a room number, character name, or object name. The target room can not be a private or god room. Valid commands are any commands usable by an object.
oecho message
Oecho sends message to everyone awake in the same room as the object. If the object is equipped or carried by someone or in something, message is sent to the room the person or object is in.
oechoaround victim message
This sends message to everyone in the room, except for the victim and the mob.
oexp victim amount
Oexp changes the victim's experience points by amount. The amount may be 100,000 exp and less, including negative values.
oforce victim command
The object forces victim to perform command. If the victim is 'all', all the characters in the room are forced to perform the command. Immortals are not affected by this command. No message is set to the character, except what is caused by the command performed.
oload <obj|mob> vnum
This command loads a mob or object into the game, in the same room as the object using the command. The object or mob's vnum must be specified; the name will not work. No message is given.
opurge [target]
Opurge removes objects or mobs from the game. If no argument is given, then all objects and mobs in the room will be removed. If there is an argument, only that mob or object will be purged. PCs can not be purged with this command. There is no message when this command is used.
osend victim message
Message is sent to victim.
osilent command
placed in front of any other command, osilent prevents this command from outputting any text.
oteleport victim target
Oteleport moves victim to target. The victim does not need to be in the room. If the victim is 'all', all the characters in the room will be teleported to the target room. No messages are generated by this command.

W O R L D   C O M M A N D S

Room triggers can use the following commands.

 

wasound message
Wasound echos message to all the rooms adjacent to the room wasounding.
wat target command
The command is performed by the room at the specified target. The target may be a room number, character name, or object name. The target room can not be a private or god room. Valid commands are any commands usable by a room.
wdamage victim amount
Hurt (or heal, with a negative amount) the character specified.
wdoor room 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 will 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, "wdoor 100 north flags abe" creates a closed, secret door to the north in room 100.
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.
wecho message
Wecho sends message to everyone awake in the room.
wechoaround victim message
This sends message to everyone in the room except for victim.
wexp victim amount
Oexp changes victim's experience points by amount. The amount may be 100,000 exp and less, including negative values.
wforce victim command
The room forces victim to perform command. If victim is 'all', all the characters in the room are forced to perform the command. Immortals are not affected by this command. No message is sent to the character, except what is caused by the command performed.
wload <obj|mob> vnum
This command loads a mob or object into the game, in the room performing the command. The object or mob's vnum must be specified; the name will not work. No message is given.
wpurge [target]
Wpurge removes objects or mobs from the game. If no argument is given, the all objects and mobs in the room will be removed. If there is an argument, only that mob or object will be urged. PCs can not be purged with this command. There is no message generated by this command.
wsend victim message
Message is sent to victim.
wsilent command
placed in front of any other command, wsilent prevents this command from outputting any text.
wteleport victim target
Wteleport moves victim to target. The victim does not need to be in the room. If the victim is 'all', all the characters in the room will be teleported to the target room. No messages are generated by this command.
Table of Contents, Previous Chapter, Next Chapter
Builder's Information | Home