WoW:API GetInboxItem: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
mNo edit summary
m (Added old example back in.)
Line 1: Line 1:
GetInboxItem(index)
<center>'''GetInboxItem''' - ''Documentation by [[User:Flickering|Flickering]]''</center>


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)
== Parameters ==
=== Arguments ===
:(index)


Example Lua Script:
:;index : Integer - The index of the message to get information from.
=== Returns ===
:name, itemTexture, count, quality, canUse


<pre>
:;name : String - The display name/label for the item.
inbox_items = GetInboxNumItems();
:;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)
if (inbox_items > 0) then
:;quality : Integer - Item quality index.
for inbox_item_index = 1, inbox_items do
:;canUse : Flag - Indicates if the player can use the item, 1 if they can use it, or nil if not.
-- Get the Message Text
== Example ==
            inbox_text = GetInboxText(inbox_item_index);
:Sample code from [[User:Inglais|Inglais]].
            -- Get the Attachment Description Text
<!-- begin code -->
inbox_item = GetInboxItem(inbox_item_index);  
inbox_items = GetInboxNumItems();
            if (inbox_text ~= nil) then
if (inbox_items &gt; 0) then
DEFAULT_CHAT_FRAME:AddMessage("Inbox Text: "..GetInboxText(inbox_item_index), 1, 1, 1); -- Print the message text
  for inbox_item_index = 1, inbox_items do
end
    -- Get the Message Text
    inbox_text = GetInboxText(inbox_item_index);
if (inbox_item ~= nil) then
    -- Get the Attachment Description Text
DEFAULT_CHAT_FRAME:AddMessage("Inbox Item: "..GetInboxItem(inbox_item_index), 1, 1, 1); -- Print the attachment description
    inbox_item = GetInboxItem(inbox_item_index);
end
    if (inbox_text ~= nil) then
end
      -- Print the message text
end
      DEFAULT_CHAT_FRAME:AddMessage("Inbox Text: "
</code></pre>
        .. GetInboxText(inbox_item_index), 1, 1, 1);
 
    end
 
    if (inbox_item ~= nil) then
[[Category:API Functions|GetInboxItem]]
      -- Print the attachment description
      DEFAULT_CHAT_FRAME:AddMessage("Inbox Item: "
        .. GetInboxItem(inbox_item_index), 1, 1, 1);
    end
  end
end
<!-- end code -->
----
__NOTOC__
{{Template:WoW API}}
[[Category:API Mail Functions|GetInboxItem]]
[[Category:API Mail Functions|GetInboxItem]]

Revision as of 17:30, 12 September 2005

GetInboxItem - Documentation by Flickering

Retrieve details about an item from a mail.

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

Parameters

Arguments

(index)
index
Integer - The index of the message to get information from.

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);
    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);
    end
  end
end

Template:WoW API