Use Item Links in Macros

Example syntax for creating a trade chat macro with an item link:

/run SendChatMessage(format("WTS %s (226) 725k ",select(2,GetItemInfo("item:183010:0:0:0:0:0:0:0:0:0:0:0:4:7187:6652:1498:6646"))),CHANNEL,nil,GetChannelName("Trade - City"))

How does it work?

Format()

:::lua format(".. %s ..", "text") This is a basic text replacement with %s being replaced by text.

-- Input:
/run SendChatMessage(format("This is a %s", "Test"), "Party")

-- Output:
"This is a Test"

GetItemInfo()

GetItemInfo(itemID or "itemString" or "itemName" or "itemLink") = itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, itemSubType, itemStackCount, itemEquipLoc, itemTexture, itemSellPrice

WoW API function that can take one of the following arguments:

  • itemID : Integer. The numeric ID of the item. e.g. 12345
  • "itemString" : String. The full item ID in string format, e.g. "item:183010:0"
    • supports partial itemStrings with any missing values being filled with 0
  • "itemName" : String.
  • itemLink : String. From shift-clicking items.

Select()

:::lua select(2, ..) returns the second value from a list of values.

Related