IMM_SCRIPTEDIT
Keywords: IMM_SCRIPTEDIT, WIZ_SCRIPTEDIT
=== STAFF MANUAL ===
Usage: scriptedit <vid>
Description:
Interactive editor for trigger scripts. Opens the target VID
in a menu-driven session where every field on a script -- name,
class, per-class trigger bitmask, string and numeric arguments,
multithread and debug flags, and the full script body -- can be
edited from a single screen. Edits are held in a scratch copy
until you quit the editor; only then are they written back to
the live trig_index and propagated to every running trigger
attached to that prototype.
If the VID does not exist yet, scriptedit creates a new
placeholder script at that number with the starter name
"new script", no class selected yet, and the body
"* Empty script".
Main Menu:
1 Script Name -- free-form label shown in sstat and
index listings.
2 Script Class -- one of MOB_TRIGGER, OBJ_TRIGGER,
WLD_TRIGGER, or GLOBAL_TRIGGER. Picking
a class gates which trigger-type bits
are available in field 3.
3 Triggers -- bitmask of trigger types from the class
you selected (for example command,
speech, load, fight, etc.). Entering a
number toggles the matching bit; enter
0 to return to the main menu.
4 Arg -- string argument. Its meaning depends on the
trigger type (keyword list for speech
triggers, command name for command
triggers, and so on).
5 Num Arg -- integer argument used by types that
need a threshold or percent chance
(random, percent, etc.).
M MultiThread -- toggles the Script_Threadable flag,
allowing the script to run in its own
scheduling slot.
D Debug Mode -- toggles the Script_DebugMode flag.
When set, the scriptengine traces the
script's execution.
6 Script body -- opens the full-screen string editor
on the script text. Use /s to save
your edit back to the scratch copy and
/h for string-editor help. The main
menu displays the first 10 lines of the
current body as a preview.
Q Quit -- prompts to save if anything was modified.
Saving:
Saving a script goes through several steps in one atomic
commit:
- The TRIG_DELETED flag is cleared automatically.
- An empty script body is normalized to
"* Empty script" to guarantee a non-empty record.
- The scratch TrigData is copy-assigned into the
matching trig_index entry (or inserted as a new
entry if this is a fresh VID).
- SetCommands is called to store the new body,
m_pCompiledScript is reset, and Compile re-runs
the script compiler. If any errors were reported
during compilation, the invoker sees:
Errors were reported; please type 'vstat trig
<vid>' to see the errors.
- Every live TrigData instance whose prototype
pointer matches the edited script is copy-assigned
from the new prototype, so running scripts on live
entities immediately pick up the change.
- The destination zone is marked dirty so the .trg
file is rewritten on the next OLC save pass.
The save is logged to the staff wiznet as:
OLC: <name> edits script <vid>
Restrictions:
- Requires the Script staff permission and build
access to the target zone.
- Creating a new script at a VID requires permission
on the destination zone, same as any other OLC add.
- Two staff cannot have the same script open at once;
the second scriptedit attempt reports which staff
member has it locked.
Notes:
- Always run vstat trig <vid> after a save if the
editor reported compilation errors -- the save
succeeds even when the script has errors, but the
script will not run in that state.
- Behavior sets (behavioredit) and global scripts
are separate systems that reference these triggers
by VID; renaming or deleting a script through this
editor does not update those references.
Related Helpfiles: WIZ_MEDIT, WIZ_OEDIT, WIZ_REDIT, WIZ_ZEDIT
=== END MANUAL ===