Thread Tools Display Modes
11-23-22, 11:58 AM   #1
fatrog
A Fallenroot Satyr
Join Date: Nov 2022
Posts: 21
Cannot get spell id from tooltip generated by metashowtooltip

Hello,

I'm facing a problem while trying to get spellid from tooltips. When I try to get it from a macro tooltip, it returns nil

Here is my code

Code:
_G["GameTooltip"]:HookScript("onShow",function(self)
    
    local spellName, spellID = self:GetSpell()
    print(spellID)
end)
The macro have a metashowtooltip (#showtooltip) instruction and the spell is well shown in the (what I thought was) the global tooltip.

Thanks for your help

EDIT: mounts return nil too. neither spells or items methods work

Last edited by fatrog : 11-23-22 at 02:00 PM.
  Reply With Quote
11-23-22, 02:30 PM   #2
fatrog
A Fallenroot Satyr
Join Date: Nov 2022
Posts: 21
I got myself through it

here's how I did it

Code:
_G["GameTooltip"]:HookScript("onShow",function(this)

    local cooldownMS, gcdMS, spellName
    local spellName, spellID = this:GetSpell()
    local itemName, ItemLink = this:GetItem()
    if spellID ~= nil then
       cooldownMS, gcdMS = GetSpellBaseCooldown(spellID)
       print("ID:"..gcdMS)
    elseif itemName ~= nil then
       spellName, spellID = GetItemSpell(ItemLink)
       cooldownMS, gcdMS = GetSpellBaseCooldown(spellID)
       print("spell from item link:"..gcdMS)
    else
       spellName = _G[this:GetName().."TextLeft"..1]:GetText()
       _,_,_,_,_,_,spellID = GetSpellInfo(spellName)
       cooldownMS, gcdMS = GetSpellBaseCooldown(spellID)
       print("spell with no ID:"..gcdMS)
    end
end)
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Cannot get spell id from tooltip generated by metashowtooltip


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