Help with understanding a macro

So, I made this macro but I’m not sure how it works. If anyone could help me that would be great.

A version of it was:

#showtooltip Shadow Mend
/cast [@mouseover, help] Shadow Mend; [harm] Smite; Shadow Mend

As I understand it, the pseudo code would be something like:

if unit is mouseover'd and friendly
    cast Shadow Mend
else if unit is unfriendly (and targeted)
    cast Smite
else
    cast Shadow Mend

Basically, this lets me mouseover heal using party frames or cast smite at my target using just one button. Having no target and nothing mouseover’d would just cast Shadow Mend on myself.

The problem was that in open world, I’d find myself in situations where I wanted to cast Shadow Mend on myself but couldn’t if I had a mob or player targeted as it would just default to the second condition. Only fix to this was to put my mouse on my own player portrait in the far upper left corner or on my toon. Obviously, this was a downside to the macro so added a little bit more to the command:

#showtooltip Shadow Mend
/cast [mod:alt] [@mouseover, help] Shadow Mend; [harm] Smite; 
Shadow Mend

After I made this change, I was able to cast Shadow Mend on myself using the alt modifier while keeping mobs targeted at the same time. I thought this was pretty neat, but I’m a bit stumped on why it works this way when I add the alt modifier. A technical explanation would be appreciated.

I can see two potential things that are happening.

The first is that you have “alt” set as your self cast key. (That will override any uses of “alt” in macros.) Although in that case, it might just ignore that conditional and work like your first macro.

The more likely scenario is that you have self cast turned on, and it’s reading that conditional as it would an empty conditional [] when the alt is pressed. If you’ve got self cast on and don’t have a friendly target, an empty conditional will self cast. In this case, if your target was friendly, it would cast Shadow Mend on them, not you. If that’s not the behavior you want, then you’d want to do something more like this:

#showtooltip Shadow Mend
/cast [mod:alt,@player] [@mouseover, help] Shadow Mend; [harm] Smite; 
Shadow Mend

That also has the benefit of working independently of your self cast setting.

Pins are your friend

#showtooltip
/cast [mod:alt,@player] [@mouseover,help,nodead] Shadow Mend; [@mouseover,harm,nodead] [harm] Smite; Shadow Mend

A common misconception. With regards to macros, the self cast key only initializes a variable SELFCAST that you can use in place of ctrl/shift/alt etc. It doesn’t automatically affect them at all.
https://wow.gamepedia.com/Macro_conditionals#Modifier_Variables

1 Like