WoW:API PickupInventoryItem: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 1: Line 1:
PickupInventoryItem(index)<br>
PickupInventoryItem(slotId)
Where index is a number refering to a slot in the character's equipment<br>
 
<br>
"Picks up" an item from the player's worn inventory.  This appears to be a kind of catch-all "pick up/activate" function.
0 = ammo<br>
 
1 = head<br>
----
2 = neck<br>
;''Arguments''
3 = shoulder<br>
 
4 = shirt<br>
:slotId
5 = chest<br>
:;slotId : Numeric - the [[API TYPE InventorySlotID|slot ID]] of the worn inventory slot.
6 = belt<br>
 
7 = legs<br>
----
8 = feet<br>
;''Returns''
9 = wrist<br>
 
10 = gloves<br>
<!-- List each return value, together with its type -->
11 = finger 1<br>
:Nothing.
12 = finger 2<br>
 
13 = trinket 1<br>
----
14 = trinket 2<br>
;''Details''
15 = back<br>
 
16 = main hand<br>
:If the cursor is empty, then it will attempt to pick up the item in the slotId.
17 = off hand<br>
: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.
18 = ranged<br>
:If the cursor is in repair or spell-casting mode, it will attempt the action on the slotId.
19 = tabard<br>
:You can use [[API GetInventorySlotInfo|GetInventorySlotInfo]] to get the slotId:
 
<table cellpadding="1" align="center">
<tr><td>GetInventorySlotInfo()</td><td>slotId</td></tr>
<tr><td>AmmoSlot</td><td>0</td></tr>
<tr><td>HeadSlot</td><td>1</td></tr>
<tr><td>NeckSlot</td><td>2</td></tr>
<tr><td>ShoulderSlot</td><td>3</td></tr>
<tr><td>ShirtSlot</td><td>4</td></tr>
<tr><td>ChestSlot</td><td>5</td></tr>
<tr><td>WaistSlot</td><td>6</td></tr>
<tr><td>LegsSlot</td><td>7</td></tr>
<tr><td>FeetSlot</td><td>8</td></tr>
<tr><td>WristSlot</td><td>9</td></tr>
<tr><td>HandsSlot</td><td>10</td></tr>
<tr><td>Finger0Slot</td><td>11</td></tr>
<tr><td>Finger1Slot</td><td>12</td></tr>
<tr><td>Trinket0Slot</td><td>13</td></tr>
<tr><td>Trinket1Slot</td><td>14</td></tr>
<tr><td>BackSlot</td><td>15</td></tr>
<tr><td>MainHandSlot</td><td>16</td></tr>
<tr><td>SecondaryHandSlot</td><td>17</td></tr>
<tr><td>RangedSlot</td><td>18</td></tr>
<tr><td>TabardSlot</td><td>19</td></tr>
<tr><td>Bag0Slot</td><td>20</td></tr>
<tr><td>Bag1Slot</td><td>21</td></tr>
<tr><td>Bag2Slot</td><td>22</td></tr>
<tr><td>Bag3Slot</td><td>23</td></tr>
</table>
 
----
;''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.


[[Category:API Functions|PickupInventoryItem]]
[[Category:API Functions|PickupInventoryItem]]
[[Category:API Cursor Functions|PickupInventoryItem]]
[[Category:API Cursor Functions|PickupInventoryItem]]
[[Category:API Inventory Functions|PickupInventoryItem]]
[[Category:API Inventory Functions|PickupInventoryItem]]
Anonymous user