Thread Tools Display Modes
05-01-20, 11:45 AM   #1
jezzi23
A Murloc Raider
Join Date: Apr 2020
Posts: 4
How to get SpellID from SpellButton1..12? (Classic)

I need to get more information about spells in the spellbook from the SpellButton1, ..., SpellButton12 frames without opening their tooltips. These 12 frames always exist and as you move between pages/tabs the 12 button frames just get updated icons/tooltips for different spells. I tried to look into what fields and it has a table field called SpellName but it just seems to contain garbage.

https://imgur.com/Kllde63

Any ideas?

Last edited by jezzi23 : 05-01-20 at 12:08 PM.
  Reply With Quote
05-01-20, 01:49 PM   #2
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
Those are FontStrings, try:
Code:
for index = 1, 12 do
    local spellButtonName = "SpellButton" .. index
    print(spellButtonName)
    print(_G[spellButtonName].SpellName:GetText())
    print(_G[spellButtonName].SpellSubName:GetText())
end
  Reply With Quote
05-01-20, 01:50 PM   #3
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,308
My initial instinct would be to look at GetSpellBookItemInfo().
There are other related functions listed here.

This is all depending on what you actually want to do with the spell buttons. Another suggestion is to look at what Blizzard does with it and how it's set up. SpellBookFrame.xml has the template the buttons are created from and SpellBookFrame.lua contains its underlying code.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 05-01-20 at 02:00 PM.
  Reply With Quote
05-01-20, 02:39 PM   #4
jezzi23
A Murloc Raider
Join Date: Apr 2020
Posts: 4
Thank you Vrul! With the spell name and spell rank as SubSpellName I can get the spell id from GetSpellInfo(...).
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » How to get SpellID from SpellButton1..12? (Classic)

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