IMM_COMPILE
Keywords: IMM_COMPILE, WIZ_COMPILE
=== STAFF MANUAL ===
Usage: compile <script vid>
Description:
Parse a script prototype into bytecode and dump the result,
including any compilation errors encountered along the way.
This is the script-engine debugger's inspection tool: it lets
you see exactly what the compiler has produced for a trigger
without attaching the trigger to anything live, and without
leaving any state behind in the world.
Behavior:
The command:
- Validates that the argument parses as a virtual ID
via IsVirtualID. Bad input prints "Usage: compile
<vnum>".
- Looks up the script in trig_index. An unknown VID
returns "Unknown script.".
- Runs ScriptCompilerParseScript against the
prototype's current source, collecting errors into a
side buffer.
- Runs ScriptCompilerDumpCompiledScript to produce a
human-readable dump of the resulting bytecode.
- If the compiler reported any errors, they are
appended to the dump under a clearly labelled header:
**** COMPILER ERRORS REPORTED
<errors>
The full dump is sent via SendPaged so long scripts are
broken across multiple screens.
Debug Mode:
Scripts flagged with Script_DebugMode in scriptedit are
parsed in debug mode, which causes the compiler to emit
extra tracing information into the bytecode. Toggling the
flag changes the verbosity of compile's output; turn it on
while chasing down a runtime issue and back off when the
inspection is done.
Restrictions:
- Requires at least Staff level -- there is no
separate permission flag.
- The argument must be a valid VID format
(<zone>:<number> or <zone>:<namespace>:<number>).
A bare number is rejected with the usage line.
- compile does not modify the prototype in any way.
It reads the source, recompiles it in a scratch
CompiledScript, and prints the result -- the live
bytecode used at runtime is untouched.
Notes:
- After editing a script in scriptedit, use compile
to verify the new source produced clean bytecode
before attaching or resetting the trigger in the
world.
- For a higher-level summary of a trigger's
attachment state (rather than its bytecode), use
vstat trig <vid> instead.
Related Helpfiles: WIZ_VSTAT, WIZ_SCRIPTEDIT
=== END MANUAL ===