Skip to content

0x03 — trigger

Builds an RVTC_DATA-like trigger record from the command stream. Depending on handler_arg_byte >> 6, it registers a trigger in the eight SCR_DATA+0x80 slots, calls CVariousTrigger::Checking(RVTC_DATA*), or clears matching trigger slots.

proven— handler traced, and exercised by at least one shipped script.

At a glance

Opcode0x03 (3)
HandlerCRadiScript::Command_03
SignatureCRadiScript::Command_03(int,SCR_DATA*,unsigned int,unsigned int)
Translation unitr_script_run0.cpp
Address— debug build; click for all 3
Handler size0x3EC (1004 bytes)
FamilyScript control, flags and values
Command size4 + extra_words * 4 bytes

Handler behaviour

Builds an RVTC_DATA-like trigger record from the command stream. Depending on handler_arg_byte >> 6, it registers a trigger in the eight SCR_DATA+0x80 slots, calls CVariousTrigger::Checking(RVTC_DATA*), or clears matching trigger slots.

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   |  0x03          |
+----------------+----------------+----------------+----------------+

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

8 documented fields. input fields are read from the command's operand words; derived fields are computed from other fields rather than stored separately.

FieldRoleMeaning
actioninputWhat to do with the trigger record, from the top two bits of the argument byte: 0/1 store it in a free wait slot, 2 test it now, 3 clear matching slots.
arginputRaw handler argument byte from the command header. It is printed only when it differs from the value the named fields already imply, so seeing it means the command uses an unusual argument encoding.
characterinputThe 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.
nameinputObject or animation name this line acts on, as text. The engine reads it as a NUL-terminated string; name_fill covers the bytes after the terminator.
trigger_flagsinputUpper half of the first operand, copied into the record.
trigger_typeinputTrigger type byte, choosing what is waited on (0x01 timer, 0x03 fade, 0x04 dialogue, 0x0B movie).
trigger_valueinputPayload for trigger types 1, 7, 0x0C, and some 0x0B cases; for a timer this is the duration as a float.
yieldderivedPause 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::GetAbstractionCharacterNumber(unsigned int&,unsigned int&,const SCR_DATA*)
  • CSsfHandler::SearchName(const char*) const
  • CVariousTrigger::Checking(RVTC_DATA*)
  • memset

Bit masks

Masks the handler applies to its argument byte or operand words:

0x0001 0xFFFF 0x00FF 0x0003 0x000F