Commands
Every line passes through the core driver first. Anything it does not consume is sent to the command interpreter for the trigger owner.
src/dgscript/dg_scripts.c. Mobile:
src/core/interpreter.c. Object and room:
src/dgscript/dg_objcmd.c and dg_wldcmd.c.
Command dispatch order
A line whose first non-space character is * is a comment. Control-flow
lines are recognized before variable substitution. Other lines are substituted into a
command buffer, checked against core commands, then dispatched by owner type.
Mobile owners have one extra fallback
If a line is not a mobile DG command, the normal character command interpreter
receives it. That is why a mobile script can use commands such as say,
emote, give, or drop. Object and room owners do
not get that fallback.
Core commands
These commands are available to all three owner types. Prefix matching in the driver makes correct spelling and spacing important; follow the forms below.
| Command | Form | Purpose |
|---|
Local state comes first
set and eval write trigger-local variables.
global moves an existing local into owner-global storage.
remote copies an existing local, or a visible owner-global value, into
another entity's globals. See variable lifetime.
Script attach syntax differs from the staff command
Inside a script, use attach <trigger-vnum> <numeric-id> or
detach <trigger-selector|all> <numeric-id>. The handler
discovers whether that ID belongs to a character, object, or room. The interactive
staff attach/detach commands use the owner keywords
documented on the staff commands page.
Control flow
Conditionals
if %actor.varexists(clue)%
%send% %actor% You already know the answer.
elseif %actor.level% >= 10
%send% %actor% You recognize the symbol.
else
%send% %actor% The mark means nothing to you.
end
The expression evaluator handles numeric and string comparisons, Boolean composition,
arithmetic through eval, and DG's substring-style operator used by existing
world scripts. Parentheses make compound conditions easier to audit.
Loops
while repeats through its matching done.
break jumps to that boundary. The driver yields after 30 iterations with an
internal wait 1 and stops after 100 total iterations, logging the runaway
trigger.
set room %actor.room%
set people %room.people%
while %people%
set next %people.next_in_room%
if %people.master% == %actor%
%teleport% %people% %actor%
end
set people %next%
done
Cache the next node before moving or purging the current entity. Trigger 11805 uses this exact pattern to move followers safely.
Switches
switch %choice%
case red
set result flame
break
case blue
set result frost
break
default
set result unknown
done
Wait and resumption
wait schedules a DG event, stores the next command as the trigger's resume
point, and returns from the driver. The same trigger instance resumes later.
wait 10Wait 10 game pulses.wait 2 sWait 2 real-time seconds.wait 3 tWait 3 in-game hours.-
wait until 14:30Resume at the next in-game 14:30;1430is also accepted.
Plan for a changed world
Characters may move, objects may be extracted, and variables on other entities may change while a trigger waits. Resolve current locations and validate targets again after long waits.
Entity command inventories
The lists below are read from the command tables in this codebase. Many commands share a verb family: send targeted text, echo locally, gecho globally, load or purge entities, teleport targets, affect doors, and log diagnostics. Use the owner-prefixed implementation unless a pseudo-command makes the script intentionally portable.
Mobile commands
Mobile-only capabilities include combat (mkill, mdamage),
inventory cleanup (mjunk), movement and remote execution
(mgoto, mat), hunting and memory, following, transformation,
and clan state.
Object commands
Object-only capabilities include binding, timer control, object value mutation, transformation, and moving an object to another room.
Room commands
Room commands operate from a location rather than a character or object.
wat executes another room command at a target room;
wmove moves a character or object.
Owner-neutral pseudo-commands
DG variable substitution recognizes command-like special fields. A line such as
%send% %actor% text resolves %send% to msend,
osend, or wsend according to the owner. This keeps a common
pattern readable across trigger types.
| Pattern | Purpose | Availability note |
|---|---|---|
| Communication |
%send%, %echo%, %gecho%,
%echoaround%, %recho%, %zoneecho%,
%asound%
|
Mapped for each owner family. |
| World mutation |
%load%, %purge%, %teleport%,
%damage%, %door%
|
Syntax is still the mapped command's syntax. |
| Remote action | %force%, %at%, %move% |
%move% maps to omove/wmove, but to
mecho for a mobile owner.
|
| Owner mutation | %transform%, %bind%, %log% |
Room %transform% maps to wecho. Only object
%bind% maps to obind; mobile and room owners get echo
fallbacks.
|
The pseudo-command does not normalize the remaining arguments. Check the mapped function when using a less common form.
Magic and affects
dg_cast
Use dg_cast '<spell name>' <target>. The spell name must be
quoted. A supplied non-empty target must resolve to an allowed character or object
unless the spell has TAR_IGNORE, and group spells are rejected. The current
implementation still reaches call_magic() with null targets when no target
text is supplied, so give every non-TAR_IGNORE spell an explicit target.
Mobile owners cast directly; object and room owners create a temporary proxy caster in
their room.
dg_cast 'cure blind' %actor%
dg_cast 'remove curse' %actor%
dg_cast 'remove poison' %actor%
dg_cast 'remove disease' %actor%
dg_affect
Use
dg_affect <target> <property> <value|off> <duration>. The property must match an apply type or affect flag. Duration must be positive.
off removes the DG affect record from the target.
Two different size limits
MAX_CMD_LENGTH, currently 16384 bytes, bounds the stored TRIGEDIT command
body. Each substituted runtime line uses MAX_INPUT_LENGTH, currently 512
bytes. Both are safety ceilings, not readability targets; split complex behavior into
clear lines and cooperating triggers.