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.
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.
Thank you! I'm at the momento not writing a stand-alone addon. I'm using WoWLua to make the 1st draft, that's why I haven't used events and such. The first idea was to create the core, and then start expanding it. Will the test the code you've provided and the post it here. Thanks!
Since I'm not a programmer and I try to create some thing here and there, I always have the strong impression that I'm doing things in the harder or uglier way.
I'm creating an addon to list all the buffs and its descriptions. In fact, I'll change it later to show the debuffs on me and my group. The first code follows:
I'm positively sure that I can use tables in a more efficient way. However, using tables in widgets is something that's always a nightmare to me.
Also, I want to make the main frame scrollable, so if I have tons of buffs, the windows don't have to resize and I can scroll it with the mouse wheel. How can I do that?
Any hint on how to make this code better (and I know it can be) will be very appreciated. Thanks!
Yeah, that's the main issue, making buttons that don't like action buttons. I'd really like a widget like Interactive Label to be able to cast a spell, even if not in combat, but couldn't find a way to do so. For example, let's say we have labels with the names and classes of players in a party. I wanted to create a system to cast a spell on someone at the party depending on his spec when the label is clicked. Seems the only way to do this is to setup dynamically a action button when I click the label and then click the action button, right?
So, I was playing around with AceGUI and I created the following code:
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?
I'm writing a small addon and right now one thing bothers me. Let's say, for example, that if I hover a character, if the player is out of range for inspection, a message is shown on the tooltip saying he's OOR (using GameTooltip:AddLine). But, if I get closer and the player is now in range, the tooltip is updated and now it shows the player is in range. I managed to do that if the tooltip is changed or hidden and then shown again (for example, if I move the mouse away and then re-hover the player). But what I want to do is to update the tooltip without having to hide or change the tooltip. I tried to use :Show() again when the unit is in range, but with no luck. Any way to refresh the tooltip to display a new data?
Thanks! This function is not listed on Wowpedia, so I couldn't find it.
Just another question, when I add the retrieved description and insert it in a tooltip, this gets a huge width, the string is not breaking itself. Anyway to prevent this from happening?
0
Yes, that's it. This is the code I've created using spellID tables (although I now have to do with this oversized FontString)
http://imgur.com/a/hVajW
0
0
0
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:
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...
0
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.
Thanks!
0
0
I'm creating an addon to list all the buffs and its descriptions. In fact, I'll change it later to show the debuffs on me and my group. The first code follows:
http://pastebin.com/MNwzje4H
I'm positively sure that I can use tables in a more efficient way. However, using tables in widgets is something that's always a nightmare to me.
Also, I want to make the main frame scrollable, so if I have tons of buffs, the windows don't have to resize and I can scroll it with the mouse wheel. How can I do that?
Any hint on how to make this code better (and I know it can be) will be very appreciated. Thanks!
0
0
0
0
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?
0
0
0
0
Just another question, when I add the retrieved description and insert it in a tooltip, this gets a huge width, the string is not breaking itself. Anyway to prevent this from happening?