Is there a #showtooltip conditional?

*** this is regarding TBC Classic ***

Suppose I want a macro that will cast either bloodthirst or devastate, depending on spec…numerical impossibilty of having both.

This works okay:

#showtooltip
/startattack
/cancelaura greater blessing of salvation
/cast bloodthirst
/cast devastate

but it’s always the generic question-mark icon*. Any way to get that to show either bloodthirst or devastate as a tooltip depending on which is known? could I do it with some sort of funky lua script?

Edit:
Technically it’s the generic question mark if I know Devastate but Bloodthirst is listed first. If I list Devastate first, it shows properly.

Pins are your friend.

#showtooltip
/startattack
/cancelaura Greater Blessing of Salvation
/cast [spec:2] Bloodthirst; [spec:3] Devastate
2 Likes

I should have mentioned this regards classic, where one can dump talent points anywhere and be considered “all three specs” in a sense.

I did try it, just in case, but it breaks the macro entirely.

Also tried this, on the odd chance:

/cast [talent:7/2] bloodthirst; [talent:9/1] devastate

But no luck…it occurred to me after the fact that I probably still would have had to have a spec designator in there anyway…something like

/cast [talent:2/7/2] bloodthirst; [talent:3/9/1] devastate

Reviewing the patch history on Wowpedia, [talent] was introduced in patch 6.0.2

The only thing that I can think of is a self-authoring macro that changes what is cast (out of combat only) based on your SPEC or based on IsSpellKnown() (or maybe it’s SpellIsKnown() - I keep having to look that one up).

I’m not sure, however, if Classic (or TBC for that matter) support EditMacro() or IsSpellKnown().

1 Like

If you’re talking BCC [spec:1] and [spec:2] should map to your two setups. There were no [talent:r/c] conditions back then.

That’s just the thing…there aren’t two setups. There is only one setup, and to change, I have to go to the trainer, pay 50g, and it resets my talents. There are three talent trees, but only ever one “spec” in BCC.

Try this. The icon/tooltip won’t change until after the first time you cast it, but it should (mostly) do what you want.

#showtooltip
/startattack
/cancelaura greater blessing of salvation
/cast Bloodthirst
/cast Devastate
/run local G=GetSpellInfo SetMacroSpell(GetRunningMacro(), G"Bloodthirst" or G"Devastate")

3 Likes

Here’s something I just quickly threw together. Untested.

local spells =
{
    ["Presence of Mind"] = "Interface//Icons//spell_mage_presenceofmind"
    ["Living Bomb"] = "Interface//Icons//Ability_Mage_LivingBomb"
}

local function updateMacro()
    if (InCombatLockdown()) then
        -- in combat, try again in 30 sec
        C_Timer.After(30, updateMacro)
    else
        -- not in combat, proceed
        for spell, icon in pairs(spells) do
            if (GetSpellInfo(spell)) then
                EditMacro("myMacro", nil, icon, "/cast "..spell)
                break
            end
        end
    end
end

-- initialize when logging in or reloading
local f = CreateFrame("Frame")
f:SetScript("OnEvent", updateMacro)
f:RegisterEvent("PLAYER_LOGIN")


-- maybe this is an easy way to capture talent changes?
f:RegisterEvent("PLAYER_TALENT_UPDATE") 


-- if that didn't do it, then this is a more complicated way to catch talent changes.
local needHook = true
local function applyHook()
    if (needHook) then
        PlayerTalentFrame:HookScript("OnHide", updateMacro)
        needHook = false   -- in case another addon calls TalentFrame_LoadUI() repeatedly
    end
end
if (PlayerTalentFrame) then
    -- another addon already initialized the frame; so hook it!
    applyHook()
else
    -- wait for the frame to be initialized, then hook it!
    hooksecurefunc("TalentFrame_LoadUI", applyHook)
end
1 Like

Ah looks like the spec condition wasn’t introduced till 3.1
So yeah, you’ll want to do what Roogna posted.

@Roogna in the future make sure you wrap your macros in code tags or the quotes get turned into smart quotes etc.

Template:

1 Like

TY all! This is pretty exciting, it works.

Code tags? Smart quotes? I don’t follow. I have been out for a while, so these are new concepts to me. And yes, that template is what I found to base the macro on. I went down this path of finding out if the row/col values were right and landed there. I got a lot of help from this forum back in the day (when TBC was original), so I like to give back when I think I can.

Wrap your code in `x3 (key to the left of 1) or else the forums format things like a word doc which breaks code.

1 Like

insert code here

Ok, I think I get it. Word is the worst :wink: