Skip to content

0x10 — clear_flag

Reads one u32 operand at SCR_DATA+0x0C. Low 16 bits are the first config/event flag id. High bits are boolean values. Number of flags is (handler_arg_byte & 0x0F) + 1. Calls CRadiApp::SetConfigEventFlag(flag_id, value) for each bit.

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

At a glance

Opcode0x10 (16)
HandlerCRadiScript::Command_10
SignatureCRadiScript::Command_10(int,SCR_DATA*,unsigned int,unsigned int)
Translation unitr_script_run0.cpp
Address— debug build; click for all 3
Handler size0xA0 (160 bytes)
FamilyScript control, flags and values
Command size4 + extra_words * 4 bytes

Documented forms

This opcode is documented under more than one name, one per branch of the handler. They are the same opcode and the same handler; which branch runs is chosen by the argument byte or a control word.

FormEngine nameWhat it does
clear_flag—Turns a config/event flag off.
set_flag—Turns a config/event flag on.
set_flags—Writes a run of consecutive event flags starting at `first`.

Handler behaviour

Reads one u32 operand at SCR_DATA+0x0C. Low 16 bits are the first config/event flag id. High bits are boolean values. Number of flags is (handler_arg_byte & 0x0F) + 1. Calls CRadiApp::SetConfigEventFlag(flag_id, value) for each bit.

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

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

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

FieldRoleMeaning
first_flaginputId of the first event flag the condition reads.
flaginputConfig/event flag id this line reads or writes.
flag_countinputHow many consecutive flags are written, 1..16.
flag_valuesinputBitmask of the values written, one bit per flag starting at first.
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:

  • CRadiApp::SetConfigEventFlag(unsigned int,bool)

Bit masks

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

0x000F 0xFFFF 0x0001