Scripts
This page documents the OpenW3D Code/Scripts source tree. It is an overview
of the gameplay script system used by the released Renegade codebase and should
not be confused with TT Scripts 4.x / Scripts 5.x.
Overview
In current OpenW3D CMake builds, Code/Scripts is compiled as a shared
library named scripts. The output name is scripts.dll in release builds
and scriptsd.dll in debug builds.
The tree contains the script runtime, factory/registration helpers, reusable toolkit scripts, mission-specific logic, and a large set of test or prototype scripts carried forward from the original source tree.
Script Runtime
Most concrete scripts derive from ScriptImpClass in scripts.h. This
helper sits on top of the engine ScriptClass interface and provides:
owner attach/detach handling
parameter-string parsing and typed accessors
save/load helpers
auto-save variable registration
default empty implementations for common engine callbacks
The most common callbacks exposed by ScriptImpClass are Created,
Destroyed, Killed, Damaged, Custom, Sound_Heard,
Enemy_Seen, Action_Complete, Timer_Expired,
Animation_Complete, Poked, Entered, and Exited.
Registration Model
Scripts are registered through ScriptFactory and ScriptRegistrar.
ScriptRegistrar maintains the global list of known script factories, can
look them up by name, and creates instances on demand.
Most source files use the convenience macro from scripts.h:
#define DECLARE_SCRIPT(x, d) \
REGISTER_SCRIPT(x, d) \
class x : public ScriptImpClass
The script name exposed to the engine is the class name passed as x. The
second argument d is a parameter-description string stored by the factory.
Parameter Strings
Each script instance can be attached with a comma-separated parameter string.
ScriptImpClass exposes helpers such as Get_Parameter,
Get_Int_Parameter, Get_Float_Parameter, and
Get_Vector3_Parameter to read those values back.
The registration string passed to DECLARE_SCRIPT documents the expected
parameter names and types. For example:
DECLARE_SCRIPT(
M00_Action,
"Start_Now=0:int, Receive_Type=14:int, Action_Priority=99:int, "
"Action_ID=0:int, _Move_Destination:vector3"
)
This means the runtime script name is M00_Action and the expected
parameters are described inline in the factory metadata.
Source Layout
The OpenW3D Code/Scripts tree is organized into a few broad buckets:
Files |
Purpose |
|---|---|
|
Core script implementation, callback stubs, parameter parsing, and save/load support. |
|
Factory and registration infrastructure used to expose scripts by name. |
|
Reusable gameplay helpers such as actions, animations, broadcasters, objectives, sounds, powerups, triggers, spawners, and object helpers. |
|
Mission-specific logic for campaign, demo, or scenario content. |
|
Prototype/demo mission scripts and mission-specific support code. |
|
Engine tests, gameplay experiments, and sample scripts used during development. |
|
Miscellaneous gameplay helpers and one-off script implementations. |
|
Utility and support code used by the scripts DLL. |
Naming Patterns
The registered names are preserved exactly as written in DECLARE_SCRIPT.
Common prefixes in the source tree include:
M00_for general-purpose Renegade mission or toolkit scriptsM01_throughM11_for mission-specific logicMPR_for thePRDemo.cppprototype/demo scriptsTest_or author-tagged names such asBMG_,DME_,RAD_,JDG_, andRMV_for test, prototype, or contributor-specific work
Scope
This page is intentionally an overview of the script system and source layout.
The generated per-script reference lives under scripts/reference and is
produced from active DECLARE_SCRIPT registrations in the local OpenW3D
source tree. It combines:
manual summaries from
scripts/openw3d-script-overrides.jsonnearby source comments when they exist
heuristic summaries derived from callback overrides and
Commands->usage
The machine-readable export for future LevelEditQt integration is
scripts/openw3d-script-catalog.json.
To regenerate the catalog and RST pages, run:
python tools/generate_openw3d_scripts_reference.py