Skip to content

0x12 — time_schedule_value

Time/schedule/event-value helper. It can call CRadiApp::SetRadiataTime, SetEventValueForScript, GetEventValueForScript, GetAbstractionCharacterNumber, and CCharacterPerson::TraverseScheduleList.

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

At a glance

Opcode0x12 (18)
HandlerCRadiScript::Command_12
SignatureCRadiScript::Command_12(int,SCR_DATA*,unsigned int,unsigned int)
Translation unitr_script_run0.cpp
Address— debug build; click for all 3
Handler size0x488 (1160 bytes)
Engine nametime_schedule_value
FamilyScript control, flags and values
Command size4 + extra_words * 4 bytes

Handler behaviour

Time/schedule/event-value helper. It can call CRadiApp::SetRadiataTime, SetEventValueForScript, GetEventValueForScript, GetAbstractionCharacterNumber, and CCharacterPerson::TraverseScheduleList.

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

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

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

FieldRoleMeaning
modeinputHandler path selector taken from the argument byte. The meaning is specific to each command.
operationderivedArgument bits 2-3, choosing what the command does: 0 sets the time from packed_time, 1 writes the selected script time value out to an event value, 2 reads an event value into the selected script time slot.
packed_timeinputA packed time/calendar tuple, not a duration: five components of 6, 6, 6, 5 and 9 bits from the low end up, each forwarded to CRadiApp::SetRadiataTime. A component of all ones is the leave-unchanged sentinel and reaches the call as -1.
part0derivedBits 0-5 of packed_time; 0x3F leaves that component unchanged.
part1derivedBits 6-11 of packed_time; 0x3F leaves that component unchanged.
part2derivedBits 12-17 of packed_time; 0x3F leaves that component unchanged.
part3derivedBits 18-22 of packed_time; 0x1F leaves that component unchanged.
part4derivedBits 23-31 of packed_time; 0x1FF leaves that component unchanged.
range_checkderivedArgument bit 4. When set and part4 is not its sentinel, the handler raises a script error and forces that component to -1. It gates a range check on the top component; it is not a duration.
slot_selectderivedSlot selector; -1 means the current/default slot.
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:

  • CCharacterPerson::TraverseScheduleList()
  • CRadiApp::SetRadiataTime(int,int,int,int,int,int)
  • CRadiScript::GetEventValueForScript(int,const SCR_DATA*)
  • CRadiScript::SetEventValueForScript(int,int,SCR_DATA*)
  • GetAbstractionCharacterNumber(unsigned int&)

Bit masks

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

0x0001 0x003F 0x0003 0x001F