0x15 — script_defaults
Sets script defaults. It calls SetDefaultCharacter, optionally sourcing the character id through GetEventValueForScript, and can call SetDefaultObjectName.
proven— handler traced, and exercised by at least one shipped script.
At a glance
| Opcode | 0x15 (21) |
|---|---|
| Handler | CRadiScript::Command_15 |
| Signature | CRadiScript::Command_15(int,SCR_DATA*,unsigned int,unsigned int) |
| Translation unit | r_script_run0.cpp |
| Address | — debug build; click for all 3 |
| Handler size | 0xB8 (184 bytes) |
| Engine name | script_defaults |
| Family | Script control, flags and values |
| Command size | 4 + extra_words * 4 bytes |
Handler behaviour
Sets script defaults. It calls SetDefaultCharacter, optionally sourcing the character id through GetEventValueForScript, and can call SetDefaultObjectName.
Encoding
The command header is one 32-bit word, as described in §3 Instruction encoding:
31 24 23 16 15 8 7 0
+----------------+----------------+----------------+----------------+
| flags | argument byte | extra words | 0x15 |
+----------------+----------------+----------------+----------------+Bits 8–15 give the number of 32-bit operand words that follow. Bits 16–23 are handed to the handler as a bitfield; on character commands bit 0 normally says whether a character selector word is present. Bit 31 is the keep-going bit.
Operand fields
7 documented fields. input fields are read from the command's operand words; derived fields are computed from other fields rather than stored separately.
| Field | Role | Meaning |
|---|---|---|
character | input | The packed 32-bit character selector word. Its low half is the character id and byte 2 is a secondary class/variant input; see character_number and character_variant. |
character_variant | input | Byte 2 of the character selector: a secondary character/class input passed alongside the id. |
default_char | derived | Argument-byte bit 0: whether a character selector word follows, which then becomes this script's default character. It is a gate, not a character id — default_char=1 means "a character is given below", not character 1. |
default_object | derived | Argument-byte bit 1: whether a default object name follows, setting the name later commands act on when they are not given one. |
event_char | derived | Argument-byte bit 7: read the default character from an event value instead of taking it literally. It changes what the following word means, which is why the line then prints event_value= rather than character=. |
event_value | input | Script event-value id that the condition or command reads. |
yield | derived | Pause the script here for one game frame; the next command runs on the following update. Lines without it keep running immediately. |
Engine calls
Engine functions this handler was observed calling:
CRadiScript::GetEventValueForScript(int,const SCR_DATA*)CRadiScript::SetDefaultCharacter(unsigned int,unsigned int,unsigned int)CRadiScript::SetDefaultObjectName(int,const char*)
Bit masks
Masks the handler applies to its argument byte or operand words:
0x0001 0x0080 0xFFFF 0x00FF 0x0002