TRIGEDIT
TRIGEDIT edits trigger prototypes. MEDIT, OEDIT, and REDIT attach those prototypes to mobiles, objects, and rooms.
src/dgscript/dg_olc.c. Oasis routing: src/olc/oasis.c.Open or create a trigger
trigedit <vnum>The argument must begin with a number. If the VNUM exists, the editor opens a copy of that prototype; otherwise it initializes a new trigger. The VNUM must belong to a real zone, and non-implementors must be assigned permission for that zone.
- You must be a connected player character in normal play state; switched or forced NPC editing is rejected.
- Only one descriptor can edit a given trigger VNUM at a time.
- Use a VNUM inside your assigned zone and confirm it is not already allocated with
tstatortlist.
Configure owner, types, and arguments
Changing Intended for changes the list presented by choice 3. The selector stops at the end of that owner's actual table: mobile triggers have 21 choices through Damage, while object and room triggers have 20. Entries explicitly marked UNUSED remain reserved and should not be selected.
Catch attachment mismatches before runtime
The attached-triggers OLC menu labels a mismatched intended owner, and wtool validate reports the bad reference. The driver contains an additional type-versus-flag diagnostic abort only in builds compiled with SCRIPT_DEBUG; normal builds must not rely on it. Fix the attachment rather than guarding around a mismatch in the body.
Before opening the command editor, write down the event contract:
- Which exact hook invokes this type?
- What does Numeric Arg mean for this hook?
- Does Arguments use prefix, substring, word, or phrase matching?
- Which event variables are guaranteed?
- Does the caller consume the return value?
The complete answers are in the trigger type reference.
Edit the command list
Choice 6 enters the multiline string editor. The stored command list is split into lines when the prototype is parsed. Indentation is optional to the driver but valuable for nested structure.
* Trigger-local guard
if %cmd.mudcommand% == examine && walls /= %arg%
set clue ash
%send% %actor% A single word glows in the plaster.
else
return 0
end- Pair every
ifwithend. - Pair every
whileorswitchwithdone. - Use
*as the first non-space character for comments. - Keep command-trigger guards at the top and return false on irrelevant input.
- Use owner-neutral pseudo-commands only when their mapped syntax is valid for this owner.
Attach the prototype in MEDIT, OEDIT, or REDIT
Open the owning entity in the appropriate OLC editor and choose S for its scripts menu:
Triggers Attached:
1) [<vnum>] <trigger name>
N) Attach trigger
X) Detach trigger
Q) QuitChoose N, then enter either a VNUM or position, vnum, such as 1, 11868. A VNUM by itself appends the trigger. The menu warns when the prototype's intended owner does not match the edited entity.
Choose X and select the numbered attachment entry to remove it. Save the parent MEDIT, OEDIT, or REDIT session after leaving the scripts menu.
Prototype order matters
Hooks walk the attached trigger list. Put narrow interceptors before broader command triggers when both could handle the same event, and document intentional ordering.
Save, reload, and prove the edit
TRIGEDIT saves the trigger prototype and writes its zone trigger file. When an existing prototype is saved, matching live trigger instances receive the new body and fields; their waits are canceled, locals are cleared, and depth is reset. The owner editor saves the attachment list separately, and TRIGEDIT does not rebuild each owner's attachment set, aggregate event flags, owner globals, or broader entity state. Test changed attachment or event behavior with a fresh mobile or object instance.
- Quit TRIGEDIT and answer yes to save the prototype.
- Attach it through the correct owner editor and save that editor.
- Use
tstat <vnum>to confirm the stored fields. - Reload the mobile or object, or revisit/reset the room as appropriate.
- Exercise positive, negative, repeated, and interrupted paths.
- Run zone validation and check the game log.
See Testing and debugging for the full sequence.
What OLC writes to disk
Use OLC for normal editing. The disk format is useful for review and recovery, but the ASCII type flags are positional and owner-specific.
#<vnum>
<name>~
<attach-type> <ASCII type flags> <numeric-arg>
<arguments>~
<command body>~
$~Attach types are 0 mobile, 1 object, and 2 room. Mobile, object, and room prototype records store each permanent attachment on a line shaped T <trigger-vnum>.
Do not hand-invent flag strings
TRIGEDIT and the source arrays own that encoding. Hand editing can silently shift a trigger to a different event when an ASCII flag position is misunderstood.