WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   How to get SpellID from SpellButton1..12? (Classic) (https://www.wowinterface.com/forums/showthread.php?t=57974)

jezzi23 05-01-20 11:45 AM

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? :)

Vrul 05-01-20 01:49 PM

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


SDPhantom 05-01-20 01:50 PM

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.

jezzi23 05-01-20 02:39 PM

Thank you Vrul! With the spell name and spell rank as SubSpellName I can get the spell id from GetSpellInfo(...). :banana:


All times are GMT -6. The time now is 02:29 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI