macro to target the focus's target?

UI and Macro
I wrote a macro but it doesn't seem to do what I want it to do. I need it to target the target of my focus. I always keep the tank on focus so I can send the pet in to assist. I also want the macro to target the nearest enemy if I don't have a focus (useful for questing)

#showtooltip Hunter's Mark
/target [@focus, exists] focustarget
/targetenemy [@target, help][@target, noexists][@target,dead]
/petattack [@target,exists]
/petfollow [@target,noexists][@target, dead][modifier]
/cast Hunter's Mark

But for some reason, when I run this macro, it targets some mob far beyond the nearest mobs that the tank is hitting, and so my pet dutifully runs off to fetch them.

What's wrong with this macro and how to I make it do what I want?

/target [@focus, exists] focustarget

This line won't work. Here's why:

You follow it up with the equivalent of tab (/targetenemy) which will target the next enemy mob.
ok, ty!

Here's what I've come up with so far. This one seems to do what I want. #showtooltip Hunter's Mark
/target [@focustarget]
/targetenemy [@target, noexists][@focus,dead]
/petattack [@target,exists]
/petfollow [@target,noexists][@target, dead][modifier]
/cast Hunter's Markthe [@focus,dead] is important if the tank dies.

I may want to add [@target,dead] to the /targetenemy because I am finding that when my target dies the macro won't target anything. Actually this is OK for me when in dungeons, because it forces me to check and see if I need to target anything and avoid the run away pet.

The [modifier] on /petfollow is my 'panick' button. If I see my pet running off because the macro did target something I don't want to attack, any modifier key will pressed will call the pet back. (CTRL-2 does the same thing on an unmodified pet bar)
The thing is what your macro does is target the focustarget, then immediately after it tabs to the next closest enemy. There's no reason to run both. You either target focustarget or you target an enemy.
I think this is what you want:

#showtooltip Hunter's Mark
/petattack [@focustarget,harm,nodead][harm,nodead]
/petfollow [noexists][dead][mod]
/targetenemy [@focus,noexists][@focus,dead]
/cast Hunter's Mark

You can always use to check step by step what your macro does and see if it's what you wanted.
In my macro, the first line targets my focus's target, and if I don't have a focus then it targets nothing. The second line only targets something if I don't already have a target or if my focus (the tank) is dead. (i'm not sure what happened to the last line, it should just say /cast Hunter's Mark)

But a huge problem I ran into is that sometimes, the tank starts attacking without a target or targets a non elite while tanking elites (Stratholme). So I end up casting hunter's mark and sending in my pet on something that is practically useless. So now I am thinking the "target the tank's target" concept is a bit overrated.

in your macro example, how does it target the focus's target?
@Sedivy, that link you gave me for is awesome! Thank you so much for posting that!
Sorry i had a typo in petattack. If you paste it in now should explain correctly.
04/17/2012 08:53 PMPosted by Sedivy
You can always use to check step by step what your macro does and see if it's what you wanted.

Sedivy, Thanks for listing a great website (Fitzcairn's Macro Explain-o-matic)! A fitting gnome-like name for the tool. You type in your macro and receive a line by line explanation. Also, errors are flagged. Used it to check out a macro to assist the tank or anyone else who is my focus. The tool takes the mystery out of writing macros. Only wish the site had a library of macros.
Another great Wow macros site:

Join the Conversation

Return to Forum