Quantcast Focusing current target based on name - WoWInterface
Thread Tools Display Modes
08-27-16, 02:19 AM   #1
RaxleMF
A Defias Bandit
Join Date: Aug 2016
Posts: 2
Focusing current target based on name

I've been trying to figure out how to have a macro that will set my target as my focus, but only if it's my Soul Effigy (Warlock Level 100 talent).

The idea is that I tie this event in with my Agony button so that when I cast Agony, it will also automatically focus the target if it's my Soul Effigy. Something along the lines of:

#showtooltip
/cast [mod:alt,@focus][] Agony
/run local (Insert script here)

The script would check if my current target's name is Soul Effigy, and if so, set it as my focus.

Thanks in advance for any and all help!
  Reply With Quote
08-27-16, 03:06 AM   #2
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
/cleartarget
/targetexact Soul Effigy
/focus [exists]
/targetlasttarget


Leave off the last line if you want to keep targeting your Soul Effigy afterward, or replace it with another /cleartarget if you want to end up not targeting anything.
__________________
Author/maintainer of Grid, PhanxChat, oUF_Phanx, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
  Reply With Quote
08-27-16, 11:16 AM   #3
RaxleMF
A Defias Bandit
Join Date: Aug 2016
Posts: 2
Thanks for the suggestion!

I had this thought too, except I didn't think of starting with /cleartarget, which fixes the issue I had. This would redundantly focus my Effigy every time I hit my Agony button, but I suppose there's no harm in it as long as I keep the /targetlasttarget at the end.

Edit: So the macro you suggested didn't work exactly as I had hoped, but I tweaked it a bit and now it's perfect. For reference, here's what I ended up with:

#showtooltip
/cast [mod:alt,@focus][] Agony
/stopmacro [@focus,exists]
/cleartarget
/targetexact Soul Effigy
/focus [exists]
/targetlasttarget [noexists]

This will just cast Agony as normal if my Soul Effigy isn't out. If it's out, it will swap to it and focus it if I don't have a focus already. With the original, I had some issues with my target dropping when I didn't want it to if my Soul Effigy was out and focused.

Last edited by RaxleMF : 08-27-16 at 11:46 AM.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » Macro Help » Focusing current target based on name

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off