WoW:API UseContainerItem: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
No edit summary
m (Move page script moved page API UseContainerItem to API UseContainerItem without leaving a redirect)
 
(14 intermediate revisions by 14 users not shown)
Line 1: Line 1:
<center>'''UseContainerItem''' ''-Documentation by [[user:The_Nerd_Wonder|The Nerd Wonder]]-''</center>
{{wowapi}} __NOTOC__
----
{{protectedapi|2.0|Use the "/use" macro command, or type, item secure attributes}}
;''Arguments''
:;:(bag,slot)
:::;bag : number - number of the bag the item is in.
:::;slot : number - slot number of the bag item you want the info for.


----
Use an item from a container. If Merchant window is open, this will sell the itemTriggered when an item is Right Clicked.
*Using container items is basicaly the same as clicking on themThis means that if you are at a vendor, your scripts can sell unintended items


UseContainerItem(bagId, slot [, onSelf])


:Bags are listed from main backback (original 16 slotter) left. Therefore if you were looking at the default bag row the bags would be numbered as such:
== Parameters ==
=== Arguments ===
:(bagId, slot [, onSelf])


::4, 3, 2, 1, 0
:;[[bagId]] : Integer - The bag id, where the item to use is located
:;slot : Integer - The slot in the bag, where the item to use is located
:;onSelf : Boolean - Optional parameter, if the item should be used on yourself (default: false).


== Example ==
UseContainerItem(1, 16, 1)


:Slots are listed from left to right, top to bottom.
====Result====
:Uses the item located in the 16th slot in your 1st bag (not backpack) on yourself.
:For instance if it's a bandage, this will bandage yourself.


::In the example of your main backback, the top row would be 1, 2, 3, 4. The bottom row would be 13, 14, 15, 16.
==Details==
:Slots in the bags are listed from left to right, top to bottom.
:A 16 slot bag has the following slot numbers:
::{| ! style="width: 150px; text-align: right; border: 1px solid white"
|-
| 1 || 2 || 3 || 4  
|-
| 5 || 6 || 7 || 8
|-
| 9 || 10 || 11 || 12
|-
| 13 || 14 || 15 || 16  
|}


----
;''Example''


UseContainerItem(0,6) would use an item in your main backback, second row down, one space to the right.
:An 18 slot bag has the following slot numbers:
::{| ! style="width: 150px; text-align: right; border: 1px solid white"
|-
|  ||  || 1 || 2
|-
| 3 || 4 || 5 || 6
|-
| 7 || 8 || 9 || 10
|-
| 11 || 12 || 13 || 14
|-
| 15 || 16 || 17 || 18
|}


 
==Protection Notes==
----
This function is protected except for the following:
{{WoW API}}
* When the (Guild) Bank is open: Move the item to/from the (Guild) Bank.
* When the Merchant frame is open: Sell the item.
* When the Mail frame is open and on the "Send Mail" tab: Add the item to the attachments.
* When the item is equippable: Equip the item.
* When the slot is empty: Do nothing.
* When the item is a locked Lockbox: Show an error message that says it's locked.
* When the item is a container (Clam Shell, Unlocked Lockbox, etc.): Open the Loot frame and show the contents.
* When the item is a book: Open the book's Gossip frame for reading.
* When the item is not a usable item: Do nothing.
* When the item starts a quest: Open the quest Gossip frame for reading.
* When the Trade frame is open: Add the item to the list of items to be traded. (I have not confirmed this)
* When the Auctions tab is open: Add item for auction pricing and submission.

Latest revision as of 04:47, 15 August 2023

WoW API < UseContainerItem

Use an item from a container. If Merchant window is open, this will sell the item. Triggered when an item is Right Clicked.

UseContainerItem(bagId, slot [, onSelf])

Parameters[edit]

Arguments[edit]

(bagId, slot [, onSelf])
bagId
Integer - The bag id, where the item to use is located
slot
Integer - The slot in the bag, where the item to use is located
onSelf
Boolean - Optional parameter, if the item should be used on yourself (default: false).

Example[edit]

UseContainerItem(1, 16, 1)

Result[edit]

Uses the item located in the 16th slot in your 1st bag (not backpack) on yourself.
For instance if it's a bandage, this will bandage yourself.

Details[edit]

Slots in the bags are listed from left to right, top to bottom.
A 16 slot bag has the following slot numbers:
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16


An 18 slot bag has the following slot numbers:
1 2
3 4 5 6
7 8 9 10
11 12 13 14
15 16 17 18

Protection Notes[edit]

This function is protected except for the following:

  • When the (Guild) Bank is open: Move the item to/from the (Guild) Bank.
  • When the Merchant frame is open: Sell the item.
  • When the Mail frame is open and on the "Send Mail" tab: Add the item to the attachments.
  • When the item is equippable: Equip the item.
  • When the slot is empty: Do nothing.
  • When the item is a locked Lockbox: Show an error message that says it's locked.
  • When the item is a container (Clam Shell, Unlocked Lockbox, etc.): Open the Loot frame and show the contents.
  • When the item is a book: Open the book's Gossip frame for reading.
  • When the item is not a usable item: Do nothing.
  • When the item starts a quest: Open the quest Gossip frame for reading.
  • When the Trade frame is open: Add the item to the list of items to be traded. (I have not confirmed this)
  • When the Auctions tab is open: Add item for auction pricing and submission.