WoW:API PickupInventoryItem: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
PickupInventoryItem( | 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. | ||
0 | |||
1 | ---- | ||
2 | ;''Arguments'' | ||
3 | |||
4 | :slotId | ||
5 | :;slotId : Numeric - the [[API TYPE InventorySlotID|slot ID]] of the worn inventory slot. | ||
6 | |||
7 | ---- | ||
8 | ;''Returns'' | ||
9 | |||
10 | <!-- List each return value, together with its type --> | ||
11 | :Nothing. | ||
12 | |||
13 | ---- | ||
14 | ;''Details'' | ||
15 | |||
16 | :If the cursor is empty, then it will attempt to pick up the item in the slotId. | ||
17 | :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 | :If the cursor is in repair or spell-casting mode, it will attempt the action on the slotId. | ||
19 | :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]] | ||
Revision as of 14:29, 18 November 2005
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-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.