Thread Tools Display Modes
10-22-20, 04:16 PM   #1
danischior
A Defias Bandit
Join Date: Oct 2020
Posts: 3
target enemy arena/world

HI, I want a macro that /targetenemyplayer [in arena] and /targetenemy [outside arena] ; to replace my tab keybind. As far as I know there is no [arena] conditional, but maybe you can find a way to help me. Thanks!
  Reply With Quote
10-22-20, 06:53 PM   #2
JDoubleU00
A Firelord
 
JDoubleU00's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 463
I don't play arena, but there is @arena1, @arena2, and @arena3. I haven't tested this, but could you check if exists @arena1 with /targetenemyplayer? If it doesn't exist, then /targetenemy? It may be too cludgy, but worth a try.

Good luck!
__________________
Author of JWExpBar and JWRepBar.
  Reply With Quote
10-23-20, 03:59 AM   #3
danischior
A Defias Bandit
Join Date: Oct 2020
Posts: 3
Originally Posted by JDoubleU00 View Post
I don't play arena, but there is @arena1, @arena2, and @arena3. I haven't tested this, but could you check if exists @arena1 with /targetenemyplayer? If it doesn't exist, then /targetenemy? It may be too cludgy, but worth a try.

Good luck!
I'll need to test it when the macro cannot find an arena memeber, but otherwise it works so thank you !
  Reply With Quote
10-23-20, 10:28 AM   #4
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
As JDoubleU00 said you can use this in a macro:
Code:
/targetenemyplayer [@arena1, exists]
/targetenemy [@arena1, noexists]
If you don't want to waste a macro slot, you could make a small addon instead:
Code:
local header = CreateFrame('Frame', nil, nil, 'SecureHandlerStateTemplate')
header:SetAttribute('unit', 'arena1')
header:SetAttribute("_onstate-unitexists", "self:SetBinding(nil, 'TAB', newstate and 'TARGETNEARESTENEMYPLAYER' or 'TARGETNEARESTENEMY')")
RegisterUnitWatch(header, true)
And here is another option that can be much more versatile if needed (full macro conditionals, multiple binds):
Code:
local header = CreateFrame('Frame', nil, nil, 'SecureHandlerStateTemplate')
header:SetAttribute("_onstate-Bind-TAB", "self:SetBinding(nil, 'TAB', newstate)")
RegisterStateDriver(header, "Bind-TAB", "[@arena1, exists] TARGETNEARESTENEMYPLAYER; TARGETNEARESTENEMY")
  Reply With Quote
11-02-20, 06:07 PM   #5
danischior
A Defias Bandit
Join Date: Oct 2020
Posts: 3
this looks awesome, thx guys !
  Reply With Quote
11-02-20, 08:03 PM   #6
JDoubleU00
A Firelord
 
JDoubleU00's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 463
Originally Posted by Vrul View Post
As JDoubleU00 said you can use this in a macro:
Code:
/targetenemyplayer [@arena1, exists]
/targetenemy [@arena1, noexists]
If you don't want to waste a macro slot, you could make a small addon instead:
Code:
local header = CreateFrame('Frame', nil, nil, 'SecureHandlerStateTemplate')
header:SetAttribute('unit', 'arena1')
header:SetAttribute("_onstate-unitexists", "self:SetBinding(nil, 'TAB', newstate and 'TARGETNEARESTENEMYPLAYER' or 'TARGETNEARESTENEMY')")
RegisterUnitWatch(header, true)
And here is another option that can be much more versatile if needed (full macro conditionals, multiple binds):
Code:
local header = CreateFrame('Frame', nil, nil, 'SecureHandlerStateTemplate')
header:SetAttribute("_onstate-Bind-TAB", "self:SetBinding(nil, 'TAB', newstate)")
RegisterStateDriver(header, "Bind-TAB", "[@arena1, exists] TARGETNEARESTENEMYPLAYER; TARGETNEARESTENEMY")
Amazing work!

Originally Posted by danischior View Post
this looks awesome, thx guys !
Happy to helped with part of the solution. These forums are awesome.
__________________
Author of JWExpBar and JWRepBar.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » Macro Help » target enemy arena/world

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