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.