-
Posted by themirrorfalse on Fri, 23 Jan 2009 22:27:58
Hi, I've been working on an addon that links your professions (including cooking) in an automated whisper to the user who asks you. I have it down working perfectly except I'm using the wrong API to generate the link. A week or so back I went browsing through WoWWiki's API list and found what I needed to make the link...
However, looking back through WoWiki's API list, I can't seem to find the one I was using before. What I currently have in my .lua is "GetSpellLink". Alas there is no obvious one called "GetTradeSkillLink"... Which API should I then use to generate a trade skill link?
(By the way, Love the book :D )
-
Posted by themirrorfalse on Fri, 23 Jan 2009 22:27:58
Hi, I've been working on an addon that links your professions (including cooking) in an automated whisper to the user who asks you. I have it down working perfectly except I'm using the wrong API to generate the link. A week or so back I went browsing through WoWWiki's API list and found what I needed to make the link...
However, looking back through WoWiki's API list, I can't seem to find the one I was using before. What I currently have in my .lua is "GetSpellLink". Alas there is no obvious one called "GetTradeSkillLink"... Which API should I then use to generate a trade skill link?
(By the way, Love the book :D )
-
Posted by jnwhiteh on Mon, 26 Jan 2009 06:13:37
Our website always has the full API list (even if not every function has been documented yet, we're still catching up with 3.0 and 3.0.8). What you're looking for it
GetTradeSkillListLink()
, which should just return the link when called. -
Posted by themirrorfalse on Tue, 27 Jan 2009 07:38:39
Ah, Thank you. I'll look into it later today.
On a side note, that function isn't listed by category and is only on the complete list. Maybe you intended it that way since it has not been documented yet.
-
Posted by jnwhiteh on Tue, 27 Jan 2009 17:15:18
Yeah the lists got a bit out of sync with stuff that hasn't been documented yet. Only those functions that are actually part of a category are listed there. Perhaps its time to add an 'uncategorized' list =)
-
Posted by themirrorfalse on Tue, 27 Jan 2009 20:13:10
Sadly,
GetTradeSkillListLink()
only works if the tradeskill window is open. I've been looking at the code from AutoProfLink, an addon that does basically what I'm trying to do, but in a messier way and won't respond to messages in party or say.if IsUsableSpell(L["Enchanting"]) and (string.sub(tempString, 2, 3) == "vz"
or string.sub(tempString, 2, 8) == "enchant") then SendChatMessage((P).. " ".. select(2,
GetSpellLink(L["Enchanting"])), "WHISPER", nil, msgFrom);
I understand this to a point. The first part, "
if IsUsableSpell(L["Enchanting"])
" passes if your current character knows enchanting. The rest of the if statement passes, if the message sent to the character is !vz (for German) or !enchant.Here's where things get tricky for me. I understand
SendChatMessage()
and that(P)
is a small variable that holds "AutoProfLink: ", which is then concatenated to the trade skill link. However, I don't understand how "select(2, GetSpellLink("Enchanting"))
" will actually link the Trade skill of the player.I've tested AutoProfLink in WoW and it works great, except for some minor things that I would like to change. Such as the big nasty nested If..then.. throughout the function, adding support for the request in channels, party, and say, and allowing the addon to respond to a wider range of commands. All of which is easy and I've done through table arrays, but I just can't wrap my head around how
GetSpellLink()
will return a trade skill. How isselect()
affecting the API to give that result? -
Posted by jnwhiteh on Wed, 28 Jan 2009 03:27:47
This is one of those cases where the documentation is out of date. That function changed and wasn't really listed in any of the changes list. GetSpellLink() returns two returns:
- link
- String - A link to the spell
- TradeSkillLink
- String - A link to the tradeskill if available, otherwise nil. (3.0.1+)
You can look up what select() does, but in this case its just getting the second return from the call, which returns the tradeskill link.
-
Posted by themirrorfalse on Thu, 29 Jan 2009 17:40:45
Yeesh, all that time spent looking for an API that didn't even need to exist. *Shakes fist at non-updated documentation*
Thanks for your help, the program works flawlessly now (or will continue to do so, until I send it to some friends to test it).
Thank you again. :D