Thread Tools Display Modes
10-31-16, 08:52 PM   #1
nicarao
A Defias Bandit
Join Date: Oct 2016
Posts: 3
get ItemLinks from GetItemInfo()

Hi people,

it is 3:30 am here and i am still having this issue, maybe you guys can help me out:

Goal

I want to make an Addon based on Ashran Commander. It should have Buttons which on click send messages in the chat (RAID_WARNING + INSTANCE_CHAT). The idea is to include Links for Items and Spells in the commands, so that people can click on the links and understand better how to play in Ashran(or later in other BGs).

Problem

Right now i fetch the spell link with this code (spellID 2825 = bloodlust):
spellLink1 = select(1,GetSpellLink(2825));
And output the link with
SendChatMessage("Use your cooldowns! like "..spellLink1.." and so on","RAID_WARNING");
specc: http://wowprogramming.com/docs/api/GetSpellLink

This works fine for spells, but for items it doesnt work (itemID 114982 = song flower) ->
itemLink1 = select(2,GetItemInfo(114982));
SendChatMessage("Rebuff! Use Bufffood and "..itemLink1.." please.","RAID_WARNING");
specc: http://wowprogramming.com/docs/api/GetItemInfo

Or i should say: it works sometimes for a couple of items, then it returns again nil. I know this has to do with the Cache/Server response for getItemInfo() but i dont know how to solve this problem in my Addon.

Please help me out. Any kind of information can bring me foward, i can also post more informations about my Addon if necessary.

Sinc. Nicarao/Priskah

Edit: If you want to see the whole code:
http://www.nicarao.eu/downloads/Ashr...kahEdition.zip

Last edited by nicarao : 10-31-16 at 09:09 PM.
  Reply With Quote
11-01-16, 05:12 AM   #2
Lombra
A Molten Giant
 
Lombra's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 554
Easiest way would probably be to hardcode the whole link. I think that will work every time.
Code:
SendChatMessage("Rebuff! Use Bufffood and |cffffffff|Hitem:114982|h[Song Flower]|h|r please.", "RAID_WARNING")
__________________
Grab your sword and fight the Horde!
  Reply With Quote
11-01-16, 06:39 AM   #3
nicarao
A Defias Bandit
Join Date: Oct 2016
Posts: 3
Originally Posted by Lombra View Post
Easiest way would probably be to hardcode the whole link. I think that will work every time.
Code:
SendChatMessage("Rebuff! Use Bufffood and |cffffffff|Hitem:114982|h[Song Flower]|h|r please.", "RAID_WARNING")
I tried that, unfortunatly it doesnt work, the message is not sent at all.
Honestliy i would like to create the item links hardcoded because they are always the same. But i havent figured out how.
|cffffffff|Hitem:114982|h[Song Flower]|h|r only works with DEFAULT_CHAT_FRAME:AddMessage
  Reply With Quote
11-01-16, 08:06 AM   #4
Lombra
A Molten Giant
 
Lombra's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 554
I removed some bits from the link that I thought were unnecessary, but maybe they're not. Try this:
Code:
SendChatMessage("Rebuff! Use Bufffood and |cffffffff|Hitem:114982::::::::110:::::|h[Song Flower]|h|r please.", "RAID_WARNING")
__________________
Grab your sword and fight the Horde!
  Reply With Quote
11-01-16, 09:44 AM   #5
nicarao
A Defias Bandit
Join Date: Oct 2016
Posts: 3
Originally Posted by Lombra View Post
I removed some bits from the link that I thought were unnecessary, but maybe they're not. Try this:
Code:
SendChatMessage("Rebuff! Use Bufffood and |cffffffff|Hitem:114982::::::::110:::::|h[Song Flower]|h|r please.", "RAID_WARNING")

Thanks for your help

Altought it doesnt work.

I also tried
Lua Code:
  1. DEFAULT_CHAT_FRAME:AddMessage("|cff9d9d9d|Hitem:7073:846:0:0:0:0:924:0|h[Broken Fang of the Gorilla]|h|r");
  2. SendChatMessage("|cff9d9d9d|Hitem:7073:846:0:0:0:0:924:0|h[Broken Fang of the Gorilla]|h|r","SAY");
  3. SendChatMessage("test","SAY");

And the output is:
1. the Itemlink in my Chatframe (only visible for me)
2. nothing
3. "test"
So this would mean that a hardcoded link is not outputable via SendChatMessage function. :<
  Reply With Quote
11-01-16, 04:02 PM   #6
Voyager
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 22
Just force it to be cached on ui load.

Lua Code:
  1. local f = CreateFrame("Frame")
  2. f:RegisterEvent("PLAYER_LOGIN")
  3. f:SetScript("OnEvent", function(self, event, ...)
  4.     f:UnregisterEvent("PLAYER_LOGIN")
  5.     f:SetScript("OnEvent", nil)
  6.     GetItemInfo(114982)
  7. end)
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » get ItemLinks from GetItemInfo()

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off