Difference between revisions of "GetEquipmentSlotMask"

1,007 bytes added ,  07:18, 22 August 2010
Added details given by ianpatt
imported>Therealneraverine
imported>QQuix
(Added details given by ianpatt)
 
Line 5: Line 5:


Returns the base object of the first equipped object to match the specified equipment slot mask.
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==
*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:'''
  '''Equipment slot bit assignments:'''
Line 30: Line 47:
An object taking up the UpperBody, LowerBody, and Foot slots would have a mask of 4 + 8 + 32 = 44.
An object taking up the UpperBody, LowerBody, and Foot slots would have a mask of 4 + 8 + 32 = 44.


==Notes==
*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.


[[Category:Functions]]
[[Category:Functions]]
[[Category:Functions (OBSE)]]
[[Category:Functions (OBSE)]]
[[Category:Inventory Functions]]
[[Category:Inventory Functions]]
[[Category:Inventory Functions (OBSE)]]
[[Category:Inventory Functions (OBSE)]]
Anonymous user