I'm amateur coder trying to put together addon for mostly personal use. So far I've made steady progress but there are few issues that I have no idea how to begin to untangle.
Firstly my addon has feature where shift-clicking provides hyperlink to spell. Mostly this works just fine, but there some spells which simply return nil when trying to call them with GetSpellLink(). Usually these seem to be honor talents for different classes. Most work fine though.
For example hunter honor talent quickshots, spellID 213538 returns nil for whatever reason
GetSpellLink(213538); --nil nil
Naturally nil nil doesn't really make for a very good "hyperlink-data" so hyperlinks simply don't work. Any idea what could be causing this?
Entire addon is up here if you want to have closer look, code is messy though and badly documented.
local function createLink(id)
local link
link = GetSpellLink(id)
if link == nil or link == "" then
link = string.format("|cff71d5ff|Hspell:%d:|h[%s]|h|r", id, (GetSpellInfo(id)))
end
return link
end
Edit: Totally untested, but hope this workaround helps you anyway.
Edit 2: Maybe
GetSpellLink(GetSpellInfo(id))
could be worth of a try if you want to make it shorter, but it could cause problems by pulling data from different spell with same name.
I'm amateur coder trying to put together addon for mostly personal use. So far I've made steady progress but there are few issues that I have no idea how to begin to untangle.
Firstly my addon has feature where shift-clicking provides hyperlink to spell. Mostly this works just fine, but there some spells which simply return nil when trying to call them with GetSpellLink(). Usually these seem to be honor talents for different classes. Most work fine though.
For example hunter honor talent quickshots, spellID 213538 returns nil for whatever reason
Naturally nil nil doesn't really make for a very good "hyperlink-data" so hyperlinks simply don't work. Any idea what could be causing this?
Entire addon is up here if you want to have closer look, code is messy though and badly documented.
https://wow.curseforge.com/projects/cheatsheet
Maybe something like this would work?:
Edit: Totally untested, but hope this workaround helps you anyway.
Edit 2: Maybe
could be worth of a try if you want to make it shorter, but it could cause problems by pulling data from different spell with same name.
Thank you,
that solution works great.
No idea why GetSpellLink() fails sometimes but this is a nice workaround.