WoW:API PickupContainerItem: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
No edit summary
No edit summary
Line 31: Line 31:
:If you have nothing else active, calling this will "pick up" the item, causing the cursor to change to the item's icon.  Once this has happened, calling this a second time will swap the two items.  Likewise, calling this when an ability that targets an item is active (for example, enchanting), then this function will "cast" that ability on the targetted item.
:If you have nothing else active, calling this will "pick up" the item, causing the cursor to change to the item's icon.  Once this has happened, calling this a second time will swap the two items.  Likewise, calling this when an ability that targets an item is active (for example, enchanting), then this function will "cast" that ability on the targetted item.


The following code will not work
PickupContainerItem(0,1)
PickupContainerItem(0,2)
PickupContainerItem(0,2)
PickupContainerItem(0,3)
but
this one will work
PickupContainerItem(0,1)
PickupContainerItem(0,2)
PickupContainerItem(0,3)
PickupContainerItem(0,4)
Trying to pickup the same item twice in the same "time tick" does not work. 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.


----
----
{{WoW API}}
{{WoW API}}

Revision as of 01:55, 7 January 2006

PickupContainerItem -Documentation by Xenoveritas-


PickupContainerItem(bag, slot);


"Picks up" an item in one of the backpacks. This appears to be a kind of catch-all "pick up/activate" function.


Arguments
(bag, slot)
bag
Integer - the integer ID bag the item is being taken from
slot
Integer - the slot number (1-based) of the item

Returns
Nothing.

Details
"Picks up" an item in one of the backpacks. This appears to be a kind of catch-all "pick up/activate" function.
If you have nothing else active, calling this will "pick up" the item, causing the cursor to change to the item's icon. Once this has happened, calling this a second time will swap the two items. Likewise, calling this when an ability that targets an item is active (for example, enchanting), then this function will "cast" that ability on the targetted item.

The following code will not work

PickupContainerItem(0,1) PickupContainerItem(0,2) PickupContainerItem(0,2) PickupContainerItem(0,3)

but

this one will work

PickupContainerItem(0,1) PickupContainerItem(0,2) PickupContainerItem(0,3) PickupContainerItem(0,4)

Trying to pickup the same item twice in the same "time tick" does not work. 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.


Template:WoW API