This small addon allows you to set up macros to cast a spell or toggle the spell it casts.
What this addon does
There are sometimes spells we macro for situations that don't have a [condition]. For instance, warriors fighting one mob will use Heroic Strike, or fighting ten mobs will use Cleave instead. Battle Shout if no Death Knight in the group, Commanding Shout otherwise. Monks might use Tiger Palm if in melee range, or Crackling Jade Lightning at a distance. Warlocks might use Curse of Elements in PVE, or Curse of Exhaustion in PVP. etc
Modifier keys like Alt+ Ctrl+ and Shift+ are useful for doubling up more than one spell onto a macro. But it can get mildly tedious hitting those extra keys to cast alternate spells for long stretches. It's even more tedious to muck around with action bars when a DK joins the group or you queue for a BG.
This addon allows you to double up spells onto macros without requiring a modifier to cast the alternate spell every time. You set up a toggle (either a separate macro or the same macro) to alternate which spell the macro will cast.
How to use
You can bring up the UI by entering /spelltoggle or /st into chat.
Hopefully the UI is self explanatory, but for each toggle you need to give it a name and the spell(s) it's going to toggle.
Once saved, you can now use the /click commands in place of /cast to cast or toggle the spell. You can copy-paste them from the bottom of the UI to your macro if you want.
For instance, if you've been using this macro:
/cast [mod:alt] Commanding Shout; Battle Shout
It casts Commanding Shout if Alt is held, and Battle Shout otherwise.
To turn this into a toggle, open /spelltoggle, click New and give it any name like "Shout". Then drag Battle Shout and Commanding Shout from your spellbook to their slots on the UI. Then click Save.
Now to cast the shout:
/click Shout:Cast
To toggle to the other shout:
/click Shout:Toggle
Just about anything you can do with /cast you can do with /click. Some examples:
To cast the current shout, unless Alt is down when it will toggle to the other shout:
/click [mod:alt] Shout:Toggle; Shout:Cast
To always do a shout even while toggling:
/click [mod:alt] Shout:Toggle
/click Shout:Cast
To cast the current shout, unless the macro is right-clicked, then toggle:
/click [btn:2] Shout:Toggle; Shout:Cast
A toggle with one spell
In addition to toggling between two spells, you can now toggle one spell on or off.
Some people macro cooldown spells to cast with other abilities. For instance:
#showtooltip Colossus Smash
/cast Bloodbath
/cast Colossus Smash
which is fine for trash or soloing, but you probably want greater control when Bloodbath is used for raid bosses. You can set up a toggle with only one spell and use this addon to toggle the spell on or off:
#showtooltip Colossus Smash
/click [mod] Bloodbath:Toggle; Bloodbath:Cast
/cast Colossus Smash
Now when you're out soloing you can have Bloodbath cast alongside Colossus Smash. When you join a raid you can toggle Bloodbath off to use the cooldown separately for more control.
If you want the spell to be active by default, make it your primary spell and leave the secondary spell slot empty.
If you want the spell to be disabled by default, make it your secondary spell and leave the primary spell slot emtpy.
Knowing what spell a toggle will cast
Because it's often not obvious what spells are enabled when they're buried into larger macros, there's an option at the bottom of each toggle to tell you what will cast when you toggle the spell.
When you log in or reload, the first spell of each toggle will be the first spell loaded.
Multiple toggles in one macro
You can also have multiple toggles for multiple cooldowns in one macro:
#showtooltip Colossus Smash
/click [mod] BerserkerRage:Toggle; BerserkerRage:Cast
/click [mod] Recklessness:Toggle; Recklessness:Cast
/click [mod] Bloodbath:Toggle; Bloodbath:Cast
/click [mod] SkullBanner:Toggle; SkullBanner:Cast
/cast Colossus Smash
and remember you can have separate macros to cast and toggle to make things simpler:
Cast a bunch of cooldowns (if toggled on) in addition to Colossus Smash:
#showtooltip Colossus Smash
/click BerserkerRage:Cast
/click Recklessness:Cast
/click Bloodbath:Cast
/click SkullBanner:Cast
/cast Colossus Smash
Toggle whether all those cooldowns will attempt to fire when you use the above macro:
/click BerserkerRage:Toggle
/click Recklessness:Toggle
/click Bloodbath:Toggle
/click SkullBanner:Toggle
Toggling more than two spells
If you're interested in alternating more than two spells in a macro, you might want to check out the addon
Select, which lets you cast from a list of spells that you can change by right-clicking the macro. Spell Toggle is more suitable for toggling spells in the heat of combat without needing to right-click anything.
If you've read this far
If you've read this far and you're asking yourself: "Why? This seems unnecessary." That's fine. This is an alternate style of keybinding I've been using for years. Occasionally someone on the official forums will ask how to do this, and I figured it was time to write a UI so anyone can set it up without lua knowledge. I don't expect this to have widespread appeal.