Thread Tools Display Modes
08-24-13, 11:14 PM   #1
Taoth
A Fallenroot Satyr
Join Date: Aug 2008
Posts: 24
Conditional Spell macro

Hey all, i'm looking to make a conditional macro and wondering if what I want is possible.

What I want the macro to be able to do is to cast Wind Shear on an arena1-3 target that is not my focus or my current target. Meaning that if I have arena1 targetted and arena2 on focus, it'll shear arena3, and then if say 20 seconds later I switch my focus to arena3 and then it'll shear arena2.

I thought "/cast [@arena#, notarget, nofocus] Wind Shear" would work but target and focus aren't conditionals >.<

Anyone know any conditionals that would prevent the cast if the intended arena# in the line was either my current target or focus?
  Reply With Quote
08-24-13, 11:58 PM   #2
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
No, you cannot compare targets in a macro and you cannot create *smart* macros for targeting. This would be akin to the macro making decisions for you.

You can assign each arena opponent to a different modifier in your macro and do the targeting logic yourself, however.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
08-25-13, 06:45 AM   #3
Malsomnus
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Apr 2013
Posts: 203
If you're interested in that sort of efficiency, you might as well consider having 3 Wind Shear buttons, one for each arena opponent
__________________
SanityCheck - If you've ever said the words "Sorry, I forgot" then you need this add-on.

Remember, every time you post a comment on an add-on, a kitten gets its wings!
  Reply With Quote
08-25-13, 08:42 PM   #4
Taoth
A Fallenroot Satyr
Join Date: Aug 2008
Posts: 24
I already have 2 and if there was a way to get what I wanted I would have a 3rd. The problem with just going straight 3 as arena1-3 is that those would not be applicable in the world, pve, or bgs. It is confusing to have to have a set of keys work one way in the world and then another in arena.

Current keys are the one @target and the one @focus. It is annoying to have to switch my focus for the rare occasional 3rd guy interrupt, as the speed of casts nowadays usually prevents it from working well anyways, and so I hoped for an option that would make getting that 3rd guy interrupt easier while still being dynamic enough for whenever the focus changes.

Thats why I wanted the conditional, because such a conditional would only be useful for only a 3rd target in the area, and thus isn't "smart" past the 3rd guy.


Unfortunately now i'm probably just going to have to make a 3rd macro specifically targeting the arena# and manually change that # every game. Close enough functioning, but just a major major pain in the ass.
  Reply With Quote
08-25-13, 09:49 PM   #5
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
You could also use Clique to bind, for example, middle-click to cast Wind Shear on enemy unit frames. Then you can just middle-click on any unit frame when you see a cast bar start on it, to cast Wind Shear on that unit.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
08-26-13, 06:23 AM   #6
elcius
A Cliff Giant
AddOn Author - Click to view addons
Join Date: Sep 2011
Posts: 75
What I want the macro to be able to do is to cast Wind Shear on an arena1-3 target that is not my focus or my current target. Meaning that if I have arena1 targetted and arena2 on focus, it'll shear arena3, and then if say 20 seconds later I switch my focus to arena3 and then it'll shear arena2.
It's certainly possible to do it, but not using a single macro, you need a macro for every unit comparison and one to swap the target and focus frames:

Code:
CreateFrame("BUTTON","SwapTargetFocus",nil,"SecureActionButtonTemplate"):SetAttribute("type","macro");
SwapTargetFocus:SetAttribute("macrotext",[[
/cleartarget [@focus,noexists]
/target focus
/targetlasttarget
/clearfocus [noexists]
/focus target
/targetlasttarget
]]);

local TestT = [[
/stopmacro [noexists][@focus,noexists]
/cleartarget
/targetlasttarget
/target arena%d
/targetlasttarget
/click [exists] __TestF%d
/targetlasttarget [noexists]
]];

local TestF = [[
/click SwapTargetFocus
/cleartarget
/targetlasttarget
/target arena%d
/targetlasttarget
/cast [exists] Wind Shear
/targetlasttarget [noexists]
/click SwapTargetFocus
]];

for i=1,3 do
	CreateFrame("BUTTON","__TestF"..i,nil,"SecureActionButtonTemplate"):SetAttribute("type","macro");
	_G["__TestF"..i]:SetAttribute("macrotext",TestF:format(i,i));
	CreateFrame("BUTTON","__Shear"..i,nil,"SecureActionButtonTemplate"):SetAttribute("type","macro");
	_G["__Shear"..i]:SetAttribute("macrotext",TestT:format(i,i));
end
/click __Shear1
/click __Shear2
/click __Shear3

this will shear the first unit (between arena1, arena2 & arena3) that is not currently your focus or target.
it requires that you actually have a focus and a target, and will probably do weird stuff if they are the same unit.

Last edited by elcius : 08-26-13 at 08:35 PM.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » Macro Help » Conditional Spell macro

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