WoW:API GetContainerNumSlots: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
No edit summary
 
m (Move page script moved page API GetContainerNumSlots to API GetContainerNumSlots without leaving a redirect)
 
(14 intermediate revisions by 14 users not shown)
Line 1: Line 1:
<center>'''GetContainerNumSlots''' ''-Documentation by [[user:Arvenis|Arvenis]]-''</center>
{{wowapi}} __NOTOC__


<!-- List return values and arguments as well as function name, follow Blizzard usage convention for args -->
Returns the total number of slots in the bag specified by the index.


  GetContainerNumSlots(index);
  numberOfSlots = GetContainerNumSlots([[bagID]]);


<!-- Describe the purpose of the function, though exhausting detail can be saved for a later section -->
== Parameters ==
=== Arguments ===
:;[[bagID]]
::: Integer - the slot containing the bag, e.g. 0 for backpack, etc.


:Gives you the number of slots available in the bag specified by the index.
=== Returns ===
----
;''Arguments''
:(index)
<!-- List each argument, together with its type -->
:;index
::: Integer - the slot containing the bag.


----
;''Returns''
<!-- List each return value, together with its type -->
:numberOfSlots
:; numberOfSlots
:; numberOfSlots
::: Integer - the number of slots in a bag.
::: Integer - the number of slots in the specified bag, or 0 if there is no bag in the given slot.
 
----
;''Details''


<!-- Details not appropriate for the main description can go here -->
== Details ==
:Valid slot numbers are 0-4, numbered from left to right including the backpack.


----
* In 2.0.3, the Key Ring(-2) always returns 32.  The size of the bag displayed is determined by the amount of space used in the keyring.
{{Template:WoW API}} :
* As of 3.0.3, immediately after a PLAYER_ENTERING_WORLD event (initial login or zone change through an instance, ie. any time you see a loading screen), several events of BAG_UPDATE are fired, one for each bag slot you have purchased.  All bag data is available during the PLAYER_ENTERING_WORLD event, but this function returns 0 for bags that have not had the BAG_UPDATE function called.  This is most likely due to the UI resetting its internal cache sometime between the PLAYER_ENTERING_WORLD event and the first BAG_UPDATE event. Also, that might be caused by the fact that some items (e.g. Ruby Essence from Oculus instance in Northrend) disappear from your bags when you're in the wrong zone.
<!-- Update the category to the appropriate subsection, and be sure to put the function name as the label for the category link. Multiple subcategories are okay if appropriate, please dont link functions to the API Functions category directly. -->
[[World of Warcraft API#Inventory_Functions|Inventory Functions]]
[[Category:API Inventory Functions|GetContainerNumSlots]]

Latest revision as of 04:45, 15 August 2023

WoW API < GetContainerNumSlots

Returns the total number of slots in the bag specified by the index.

numberOfSlots = GetContainerNumSlots(bagID);

Parameters

Arguments

bagID
Integer - the slot containing the bag, e.g. 0 for backpack, etc.

Returns

numberOfSlots
Integer - the number of slots in the specified bag, or 0 if there is no bag in the given slot.

Details

  • In 2.0.3, the Key Ring(-2) always returns 32. The size of the bag displayed is determined by the amount of space used in the keyring.
  • As of 3.0.3, immediately after a PLAYER_ENTERING_WORLD event (initial login or zone change through an instance, ie. any time you see a loading screen), several events of BAG_UPDATE are fired, one for each bag slot you have purchased. All bag data is available during the PLAYER_ENTERING_WORLD event, but this function returns 0 for bags that have not had the BAG_UPDATE function called. This is most likely due to the UI resetting its internal cache sometime between the PLAYER_ENTERING_WORLD event and the first BAG_UPDATE event. Also, that might be caused by the fact that some items (e.g. Ruby Essence from Oculus instance in Northrend) disappear from your bags when you're in the wrong zone.