WoW:API PickupInventoryItem

Revision as of 05:02, 4 January 2006 by WoWWiki>Muert
PickupInventoryItem(slotId)

"Picks up" an item from the player's worn inventory. This appears to be a kind of catch-all "pick up/activate" function.


Arguments
slotId
slotId
Numeric - the slot ID of the worn inventory slot.

Returns
Nothing.

Details
If the cursor is empty, then it will attempt to pick up the item in the slotId.
If the cursor has an item, then it will attempt to equip the item to the slotId and place the previous slotId item (if any) where the item on cursor orginated.
If the cursor is in repair or spell-casting mode, it will attempt the action on the slotId.
You can use GetInventorySlotInfo to get the slotId:
GetInventorySlotInfo()slotId
AmmoSlot0
HeadSlot1
NeckSlot2
ShoulderSlot3
ShirtSlot4
ChestSlot5
WaistSlot6
LegsSlot7
FeetSlot8
WristSlot9
HandsSlot10
Finger0Slot11
Finger1Slot12
Trinket0Slot13
Trinket1Slot14
BackSlot15
MainHandSlot16
SecondaryHandSlot17
RangedSlot18
TabardSlot19
Bag0Slot20
Bag1Slot21
Bag2Slot22
Bag3Slot23

Example
/script PickupInventoryItem(GetInventorySlotInfo("MainHandSlot"))
/script PickupInventoryItem(GetInventorySlotInfo("SecondaryHandSlot"))

The above attempts a main-offhand weapon swap. It will pick up the weapon from main hand and then pick up the weapon from offhand, attempting to equip the main-hand weapon to off-hand and sending the off-hand to main-hand if possible.


Template:WoW API