WoW API: PickupInventoryItem

From AddOn Studio
Jump to navigation Jump to search
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
AmmoSlot 0
HeadSlot 1
NeckSlot 2
ShoulderSlot 3
ShirtSlot 4
ChestSlot 5
WaistSlot 6
LegsSlot 7
FeetSlot 8
WristSlot 9
HandsSlot 10
Finger0Slot 11
Finger1Slot 12
Trinket0Slot 13
Trinket1Slot 14
BackSlot 15
MainHandSlot 16
SecondaryHandSlot 17
RangedSlot 18
TabardSlot 19
Bag0Slot 20
Bag1Slot 21
Bag2Slot 22
Bag3Slot 23

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

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


WoW API < PickupInventoryItem