(Hex macro) Send party message only if current target is an enemy

I’ve made a macro that marks the target with a square, casts hex and sends a chat message telling the party what I’m hexing.

However I often miss click this button, when I don’t wan’t to hex, hence spamming the party with useless information.

Is there a way to only send a party message, if I have an enemy as my target? That would reduce the misinformation.

I’ve tried adding [exist] in front of the chat message, but then the message doesn’t appear at all.

This is what I have now:

#showtooltip
/cast Hex
/tm 0
/tm 6
/run SendChatMessage("%t marked with {square} is being hexed", "PARTY")
/run if UnitIsEnemy("player", "target") then SendChatMessage("%t marked with {square} is being hexed", "PARTY") end
2 Likes

@Ketho Awesome man. Works perfectly. Thanks!

I have improved my macro a bit to prevent accidental spam even better. Sometimes I spam my hex button for no reason, so I have added a 3 second spam protection window.

This is the macro:

#showtooltip
/cast Hex
/tm 0
/tm 6
/run if UnitIsEnemy("player", "target") and GetTime()>(spamwait or 0) then spamwait=GetTime()+3 SendChatMessage("%t marked with {square} is being hexed", "SAY") end

What it does

  • Cast Hex
  • Removes raid/dungeon markers if the target has any
  • Adds square raid/dungeon marker to the target
  • If the target is an enemy then send a message to the party chat, announcing that the target is being hexed and marked with a square. This has a 3 second spam protection window, meaning that the message can only be broadcasted to party chat once every 3 seconds.
1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.