Yes, that's it. This is the code I've created using spellID tables (although I now have to do with this oversized FontString)
Okay, I sit corrected. It only returns the info by name if you have the spell in your spellbook. Apologies!
Before someone tries to solve your problem, just a friendly FYI: Wowprogramming is outdated, and no longer supported. The owner of the site has completely quit writing AddOn code and maintaining the site. Use Wowpedia.org instead.
For example, the returns on GetSpellInfo are different on Wowpedia (7.0.3, didn't change in 7.1) than Wowprogramming. http://wow.gamepedia.com/API_GetSpellInfo
GetSpellInfo should get any spell, known or not. The seventh return is the spellID.local ResurrectionID = select(7, (GetSpellInfo("Resurrection")))
It seems so that it's impossible to get the ID of a spell using only its name if I don't have it, right? I was thinking about creating a very small add-on that would tell me what some enchants do in the tooltip (since this only shows the name of it). I've came up with this code, that's not working:
GameTooltip:HookScript("OnTooltipSetItem", function(tooltip) local encPrefix = string.match(_G["ENCHANTED_TOOLTIP_LINE"], ".+:%s*") for i = 1, tooltip:NumLines() do local line = _G["GameTooltipTextLeft" .. i] local text = line:GetText() local enchant, count = string.gsub(text, "(" .. encPrefix .. ")(.+)", "%2") if (count ~= 0) then --print(enchant) local link = GetSpellLink(enchant) --print(link) if (link) then local spellID = string.gsub(link, "(|Hspell:)(%d+)(|h)", "%2") if (spellID) then local spellDesc = GetSpellDescription(spellID) text = text .. "\n" .. spellDesc line:SetText(text) end end end end tooltip:Show() end)
I was trying to get the spellID from the spell link, however the API only creates links for spells you know too (using spell name).
It seems I'll have to create a table with the spells I want to replace, localizing the names of the spells...
Hi, I'd like to know if it's possible to get the SpellID of a spell I don't have in my spellbook. GetSpellInfo() only returns ID's of spells I own. Any ideas?
I've tried GetSpellLink("name"), but it seems it works only with spell you've got too.
local frmMain = frame:Create("Frame") frmMain:SetCallback("OnClose", function(widget) frame:Release(widget) end) frmMain:SetLayout("list") local label = frame:Create("InteractiveLabel") label:SetText("Test") label:SetColor(255, 255, 255) label:SetHighlight(255, 255, 0, 0.5) label:SetCallback("OnClick", function(button) CastSpellByName("Cone of Cold") end) frmMain:AddChild(label)After clicking the label, WoW fired an error saying the addon tryed to use a function only available to Blizzard. This ain't totally unexpected, but the question is: how can I make this label cast a spell? Do I have to use a secure template? How?