WoW API: PickupContainerItem

From AddOn Studio
Revision as of 13:42, 4 July 2006 by WoWWiki>Starlightblunder (Details + {{wowapi}})
Jump to navigation Jump to search

WoW API < PickupContainerItem

Wildcard function usually called when a player clicks on a slot in their bags. Functionality includes picking up the item from a specific bag slot, putting the item into a specific bag slot, and applying enchants (including poisons and sharpening stones) to the item in a specific bag slot.

PickupContainerItem(bagID, slot);

Arguments
(bagID, slot)
bagID
Integer - id of the bag the slot is located in.
slot
Integer - slot inside the bag (top left slot is 1, slot to the right of it is 2).

Returns
Nothing.

Details
The function behaves differently depending on what is currently on the cursor:
  • If the cursor currently has nothing, calling this will pick up an item from your backpack.
  • If the cursor currently contains an item (check with CursorHasItem()), calling this will place the item currently on the cursor into the specified bag slot. If there is already an item in that bag slot, the two items will be exchanged.
  • If the cursor is set to a spell (typically enchanting and poisons, check with SpellIsTargeting()), calling this specifies that you want to cast the spell on the item in that bag slot.
Trying to pickup the same item twice in the same "time tick" does not work (client seems to flag the item as "modified" and waits for the server to sync). To get around the problem, you need to use an _OnUpdate function, check that at least .1 time has elapsed since the last time before picking up the same item.