GetEquipmentSlotMask

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search

A command for Oblivion Script Extender

Syntax:

(objectID:ref) reference.GetEquipmentSlotMask slotMask:long value:long

Returns the base object of the first equipped object to match the specified equipment slot mask.

SlotMask selectss the slots you are interested in.

Value determines whether you want equipment that DO or DO NOT use each slot selected with the mask (see Notes).


Notes[edit | edit source]

  • If no 'value' parameter is specified, it is assumed to be the same value as the 'mask' parameter.
  • A value of 0 is returned by the function if the slot is empty.
  • Multiple parts are selected by adding the values for each slot together, so if you had something using both the upper and lower body, that'd be 4 + 8 = 12.
  • A simple query like "what item is using both the upper and lower body slots" would then be GetEquipmentSlotMask 12 12 (with the second 12 not being needed since both numbers are the same.
  • For a more complex query like "what item is using the upper and lower body slots but not the foot slot", you need to figure out two numbers. The first number is the sum of the slots that you are interested in: 4 (upper) + 8 (lower) + 32 (foot) = 44. The second number is the expected result of the query: 4 (upper) + 8 (lower) = 12 (not adding 32 since we want the foot slot to NOT be selected).
  • Internally this is implemented just by doing an if((object->slotMask & mask) == value).
Equipment slot bit assignments:
 0x00000001 1 Head
 0x00000002 2 Hair
 0x00000004 4 UpperBody
 0x00000008 8 LowerBody
 0x00000010 16 Hand
 0x00000020 32 Foot
 0x00000040 64 RightRing
 0x00000080 128 LeftRing
 0x00000100 256 Amulet
 0x00000200 512 Weapon
 0x00000400 1024 BackWeapon
 0x00000800 2048 SideWeapon
 0x00001000 4096 Quiver
 0x00002000 8192 Shield
 0x00004000 16384 Torch
 0x00008000 32768 Tail
 0x00010000 65536 Weapon
 0x00020000 131072 Ammo
 0x00040000 262144 Ranged Weapon

Example: An object taking up the UpperBody, LowerBody, and Foot slots would have a mask of 4 + 8 + 32 = 44.