GetNextItemInInventory(object)

Determines the first item in an object's inventory.

object GetNextItemInInventory(
    object oTarget = OBJECT_SELF
);

Parameters

oTarget

The object that has the inventory. (Default: OBJECT_SELF)


Description

Returns the next item in oTarget's inventory or OBJECT_INVALID if the caller is not a creature, item, placeable or store, or if no more items are found.



Remarks

GetFirstItemInInventory() should be called on oTarget before this function is be called.


Version

1.22

Example

// This function counts up the total number of items in the first PC's inventory.
//(The number of items in a stackable count toward the total)
void main()
{
   int nItems = 0;
   object oItem = GetFirstItemInInventory(GetFirstPC());
   while (GetIsObjectValid(oItem) == TRUE)
   {
      nItems = nItems + GetNumStackedItems(oItem);
      oItem = GetNextItemInInventory(GetFirstPC());
   }
}

See Also

functions: GetFirstItemInInventory
categories: Inventory Functions


 author: Tom Cassiotis, editor: Charles Feduke
 Send comments on this topic.