Skip to content

0x19 — personal_inventory

Resolves a personal data record and calls CPersonalData inventory methods including SetPossessionItem, GetOneItemNum, GetItemInfo, GetSpecialItemNum, GetNormalItemNum, and DeletePossessionItem. Can write a result to a script event value.

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

At a glance

Opcode0x19 (25)
HandlerCRadiScript::Command_19
SignatureCRadiScript::Command_19(int,SCR_DATA*,unsigned int,unsigned int)
Translation unitr_script_run0.cpp
Address— debug build; click for all 3
Handler size0x338 (824 bytes)
Engine namepersonal_inventory
FamilyScript control, flags and values
Command size4 + extra_words * 4 bytes

Handler behaviour

Resolves a personal data record and calls CPersonalData inventory methods including SetPossessionItem, GetOneItemNum, GetItemInfo, GetSpecialItemNum, GetNormalItemNum, and DeletePossessionItem. Can write a result to a script event value.

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

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

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

FieldRoleMeaning
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.
delete_indexderivedIndex selecting which delete to act on.
event40derivedBit 6 of the argument byte: the handler reads a script event value on this path.
event80derivedBit 7 of the argument byte: the handler writes its result to a script event value.
flag5derivedBoolean option 5 taken from the handler's argument byte.
item_idinputIdentifier selecting which item to use.
modeinputHandler path selector taken from the argument byte. The meaning is specific to each command.
post_set_flagsinputBoolean options for post set, packed one per bit.
quantityinputHow many of the item to add or remove.
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:

  • CPersonalData::DeletePossessionItem(unsigned int)
  • CPersonalData::GetItemInfo(unsigned int) const
  • CPersonalData::GetNormalItemNum() const
  • CPersonalData::GetOneItemNum(unsigned int)
  • CPersonalData::GetSpecialItemNum() const
  • CPersonalData::SearchItemInfo(unsigned int,unsigned int,int*) const
  • CPersonalData::SetPossessionItem(unsigned int,int)
  • CRadiScript::GetAbstractionCharacterNumber(unsigned int&,unsigned int&,const SCR_DATA*)
  • CRadiScript::GetAbstractionItemNumber(unsigned int&,const SCR_DATA*)
  • 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 0xFFFF 0x0003 0x0020 0x0040 0x0080