WoW:API GetInboxItem: Difference between revisions

(GetInboxItem(index) - Gets a text description of the item attached to inbox message at [index])
 
m (Move page script moved page API GetInboxItem to API GetInboxItem without leaving a redirect)
 
(7 intermediate revisions by 7 users not shown)
Line 1: Line 1:
GetInboxItem(index)
{{wowapi}}


Where index is the index of the message you want to get the attached item information about.
Retrieve details about an item from a mail.
Index starts at 1, unlike an array subscript.


Returns a text description of the item.
name, itemTexture, count, quality, canUse = GetInboxItem(index, itemIndex)
== Parameters ==
=== Arguments ===
:(index, itemIndex)


Example Lua Script:
:;index : Integer - The index of the message to get information from.


<pre>
:;itemIndex : Integer - The index of the item (1-ATTACHMENTS_MAX_RECEIVE(16))
inbox_items = GetInboxNumItems();
 
=== Returns ===
if (inbox_items > 0) then
:name, itemTexture, count, quality, canUse
for inbox_item_index = 1, inbox_items do
 
-- Get the Message Text
:;name : String - The display name/label for the item.
            inbox_text = GetInboxText(inbox_item_index);
:;itemTexture : String - The path for the texture to display for the item.
            -- Get the Attachment Description Text
:;count : Integer - How many of the item are available in the mail (I believe 0 means that the item has been retrieved)
inbox_item = GetInboxItem(inbox_item_index);  
:;quality : Integer - Item quality index.
            if (inbox_text ~= nil) then
:;canUse : Flag - Indicates if the player can use the item, 1 if they can use it, or nil if not.
DEFAULT_CHAT_FRAME:AddMessage("Inbox Text: "..GetInboxText(inbox_item_index), 1, 1, 1); -- Print the message text
== Example ==
end
:Sample code from [[User:Inglais|Inglais]].
<!-- begin code -->
if (inbox_item ~= nil) then
inbox_items = GetInboxNumItems();
DEFAULT_CHAT_FRAME:AddMessage("Inbox Item: "..GetInboxItem(inbox_item_index), 1, 1, 1); -- Print the attachment description
if (inbox_items &gt; 0) then
end
  for inbox_item_index = 1, inbox_items do
end
    -- Get the Message Text
end
    inbox_text = GetInboxText(inbox_item_index);
</code></pre>
    -- Get the Attachment Description Text
    inbox_item = GetInboxItem(inbox_item_index, 1);
    if (inbox_text ~= nil) then
      -- Print the message text
      DEFAULT_CHAT_FRAME:AddMessage("Inbox Text: "
        .. GetInboxText(inbox_item_index), 1, 1, 1);
    end
    if (inbox_item ~= nil) then
      -- Print the attachment description
      DEFAULT_CHAT_FRAME:AddMessage("Inbox Item: "
        .. GetInboxItem(inbox_item_index, 1), 1, 1, 1);
    end
  end
end
<!-- end code -->
 
==Details==
: As of 2.3.3 this function is bugged and the quality is always set to -1.
 
__NOTOC__

Latest revision as of 04:45, 15 August 2023

WoW API < GetInboxItem

Retrieve details about an item from a mail.

name, itemTexture, count, quality, canUse = GetInboxItem(index, itemIndex)

Parameters

Arguments

(index, itemIndex)
index
Integer - The index of the message to get information from.
itemIndex
Integer - The index of the item (1-ATTACHMENTS_MAX_RECEIVE(16))

Returns

name, itemTexture, count, quality, canUse
name
String - The display name/label for the item.
itemTexture
String - The path for the texture to display for the item.
count
Integer - How many of the item are available in the mail (I believe 0 means that the item has been retrieved)
quality
Integer - Item quality index.
canUse
Flag - Indicates if the player can use the item, 1 if they can use it, or nil if not.

Example

Sample code from Inglais.
inbox_items = GetInboxNumItems();
if (inbox_items > 0) then
  for inbox_item_index = 1, inbox_items do
    -- Get the Message Text
    inbox_text = GetInboxText(inbox_item_index);
    -- Get the Attachment Description Text
    inbox_item = GetInboxItem(inbox_item_index, 1);
    if (inbox_text ~= nil) then
      -- Print the message text
      DEFAULT_CHAT_FRAME:AddMessage("Inbox Text: "
        ..  GetInboxText(inbox_item_index), 1, 1, 1);
    end
    if (inbox_item ~= nil) then
      -- Print the attachment description
      DEFAULT_CHAT_FRAME:AddMessage("Inbox Item: "
        .. GetInboxItem(inbox_item_index, 1), 1, 1, 1);
    end
  end
end

Details

As of 2.3.3 this function is bugged and the quality is always set to -1.