Skip to main content

Script Lifecycle

A Hexis script declares metadata and configuration at file scope, then exposes hexis.main() as its execution entry point.

File-scope declarations

Use hexis.script to declare metadata and hexis.config to define generated settings. Avoid movement, GUI, chat, or network side effects at file scope because Hexis may parse the file to inspect its metadata.

Execution

Hexis calls hexis.main() when the user starts the script. Long-lived scripts should periodically check hexis.script.is_running() and use finite waits.

Waiting and events

hexis.wait() pauses the script execution thread and checks for stop requests during the wait. Event registrations become active for normal execution and should be removed when no longer needed.

Stopping

A user stop, script error, world change, or explicit hexis.script.stop() ends execution. Scripts should release navigation, movement, GUI watchers, and event registrations on every terminal path they control.