WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Macro Help (https://www.wowinterface.com/forums/forumdisplay.php?f=140)
-   -   target enemy arena/world (https://www.wowinterface.com/forums/showthread.php?t=58341)

danischior 10-22-20 04:16 PM

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!

JDoubleU00 10-22-20 06:53 PM

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!

danischior 10-23-20 03:59 AM

Quote:

Originally Posted by JDoubleU00 (Post 337389)
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 !

Vrul 10-23-20 10:28 AM

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")


danischior 11-02-20 06:07 PM

this looks awesome, thx guys !

JDoubleU00 11-02-20 08:03 PM

Quote:

Originally Posted by Vrul (Post 337396)
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!

Quote:

Originally Posted by danischior (Post 337485)
this looks awesome, thx guys !

Happy to helped with part of the solution. These forums are awesome.


All times are GMT -6. The time now is 02:47 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI