Difference between revisions of "GetNumItems"

Jump to navigation Jump to search
129 bytes added ,  18:16, 21 March 2008
standardized syntax, added note about improved efficiency in v0013(?), added See Also section, and also this is not a record variable function
imported>Haama
(Added to Functions category)
imported>DragoonWraith
(standardized syntax, added note about improved efficiency in v0013(?), added See Also section, and also this is not a record variable function)
Line 2: Line 2:


'''Syntax:'''
'''Syntax:'''
  GetNumItems
  (numItems:short) [''ref.'']GetNumItems


Must be called on a reference. Returns the number of unique items in the object's inventory.
Must be called on a reference. Returns the number of unique items in the reference's inventory.


==Notes==
==Notes==
Line 12: Line 12:
*Equipped items and identical items that are unequipped are still only one unique item
*Equipped items and identical items that are unequipped are still only one unique item
*Using this function every frame will significantly drop FPS. The more items that have to be scanned, the worse it is (i.e., 1 item a frame will drop it by 3, 15 by 25). Use this function only when necessary, and try to avoid using it in [[GameMode]].
*Using this function every frame will significantly drop FPS. The more items that have to be scanned, the worse it is (i.e., 1 item a frame will drop it by 3, 15 by 25). Use this function only when necessary, and try to avoid using it in [[GameMode]].
**There are several ways to use [[GetInventoryObject]] instead of '''GetNumItems''' (keep in mind that it is also CPU-heavy, but not as much).<br>
**There are several ways to use [[GetInventoryObject]] instead of '''GetNumItems''' (keep in mind that it is also CPU-heavy, but not as much)
**v0013 significantly improves the efficiency of this function
 
If you need to test if a container has items in it, use
If you need to test if a container has items in it, use
  ref pInvObj
  ref pInvObj
Line 29: Line 31:
   if pInvObj
   if pInvObj
  ...
  ...
 
 
== See Also ==
* [[GetInventoryObject]] 
   
   
[[Category: Functions]]
[[Category: Functions]]

Navigation menu