WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Search/Requests (https://www.wowinterface.com/forums/forumdisplay.php?f=6)
-   -   Addon for selecting assigning specific targets (https://www.wowinterface.com/forums/showthread.php?t=56084)

ilion 03-08-18 11:59 PM

Addon for selecting assigning specific targets
 
Hi all, looking for an addon that treats the focus as a secondary selection for targets that are friendly (healable) without modifying current target. Any other targets are targeted as normal

So: on click of character model or frame:
if a target is friendly and alive, set to focus, and do no set to target
if else, behave normally

Expected behavior: if i already have a target and select a friendly, i keep my same old target and assign that friendly to focus. if i have no target and select a friendly, they are set to focus and i still have no target.

Does this exist? If not is it doable and is anyone up to the challenge?

So here's the functionality in macro form, but instead of pressing a button, pressing left click (again, must work on character models too which is why clique wont work)

Code:

/target [@mouseover,nohelp]
/focus [@mouseover,help]
/cleartarget [focus=target]
/targetlasttarget

THANK YOU!

Phanx 03-09-18 02:56 AM

Not possible. Addons cannot change what happens when you click on a unit in the game world.

You could compensate by running your existing macro, with minor changes, after selecting the target:

Code:

/stopmacro [nohelp]
/focus
/targetlasttarget
/cleartarget [focus=target]

I am curious, though, how are you clicking on units in the game world so often that this is even an issue? In more than a decade of playing WoW, much of that time as a healer in raids, I can't recall ever clicking a friendly unit in the game world on purpose... :confused:

ilion 03-09-18 09:25 AM

That makes me sad. At least I know itís not possible. Itís not just for raid, itís also for small PvP dungeons, etc
. Also clicking the nameplates, not just the character models. I just wanted to make being a disc priest more fluid. All heals would be replaced with a focus heal with a mod key to heal myself. So switching targets/focuses would be done in between spells during gcd.

ilion 03-09-18 10:51 AM

So when you click on a unit in the game world, is there a way of piggybacking off of the function rather than modifying whats there, or is that all apart of the protected aspect of those functions?

Ammako 03-09-18 11:31 AM

Quote:

Originally Posted by ilion (Post 327151)
So when you click on a unit in the game world, is there a way of piggybacking off of the function rather than modifying whats there, or is that all apart of the protected aspect of those functions?

Quote:

Originally Posted by Phanx (Post 327147)
Addons cannot change what happens when you click on a unit in the game world.

AKA, no.

You can make other things happen when you target a unit with PLAYER_TARGET_CHANGED event, but setting that target to focus is not one of those things, and you can't prevent that unit from getting targeted as a result of the click.

Click on the unit, it will get targeted. To focus you have to use a separate macro to do it, or manually right-click --> focus on their unit frame. No way around that.

You'll be better off learning to heal via raid/party frames than by clicking units on the game world (or via mouseover macros, even.)

ilion 03-09-18 12:18 PM

Thanks for the scripting information! Also, instead of changing my playstyle like youve suggested, I'll continue to use my macro that is listed above which works, but will just be a keybind instead of a mousebind. Thanks all

semlar 03-09-18 12:56 PM

I'm going to have to respectfully disagree with my colleagues here, because it should be possible to rebind left click to your macro in response to mousing over a friendly unit using a secure state driver.

MunkDev 03-09-18 02:20 PM

While you can certainly do something like this:
Lua Code:
  1. local Button = CreateFrame('Button', 'WhateverYouWannaCallIt', nil, 'SecureHandlerStateTemplate, SecureActionButtonTemplate')
  2.  
  3. Button:SetAttribute('type', 'focus')
  4. Button:SetAttribute('unit', 'mouseover')
  5.  
  6. RegisterStateDriver(Button, 'friendlymouse', '[@mouseover,help]true;nil')
  7. Button:SetAttribute('_onstate-friendlymouse', [[
  8.     if newstate then
  9.         self:SetBindingClick(true, 'BUTTON1', self:GetName())
  10.     else
  11.         self:ClearBindings()
  12.     end
  13. ]])

...it doesn't change the fact that unit frames will consume your left click. Even if you set left mouse button to focus, your "focus button" won't receive the click because there's a unit frame in the way that doesn't propagate it further. You can use this for any other key binding and it will work, but mouse buttons retain their UI functionality if you're mousing over a mouse-enabled widget, even with overrides.

The only solution AFAIK is to use the state driver above and set each of your unit frames like so:
Lua Code:
  1. unitFrame:SetAttribute('type', 'focus')

semlar 03-09-18 02:29 PM

Quote:

Originally Posted by MunkDev (Post 327155)
Even if you set left mouse button to focus, your "focus button" won't receive the click because there's a unit frame in the way that doesn't propagate it further. You can use this for any other key binding and it will work, but mouse buttons retain their UI functionality if you're mousing over a mouse-enabled widget, even with overrides.

While unit frames will intercept the mouse, it just means you'll have to write additional code to wrap the click on the frame (or just put your own macro/unit frame under the mouse).

MunkDev 03-09-18 02:38 PM

Quote:

Originally Posted by semlar (Post 327156)
While unit frames will intercept the mouse, it just means you'll have to write additional code to wrap the click on the frame (or just put your own macro/unit frame under the mouse).

Haven't tested this, but what happens to the mouseover unit/conditional if you're blocking the mouse with your own frame to intercept the click?

semlar 03-09-18 02:46 PM

Quote:

Originally Posted by MunkDev (Post 327157)
Haven't tested this, but what happens to the mouseover unit/conditional if you're blocking the mouse with your own frame to intercept the click?

You wouldn't use @mouseover, you would change the macro target to whatever the unit attribute is on the frame.

I'm on a phone right now, otherwise I would write an example.

The first sentence in Clique's description mentions that it works on units "in the 3D world", but if that isn't working you should still be able to use it to trigger the macro on unit frames and just write a small addon to rebind left click on units in the game world.


All times are GMT -6. The time now is 05:01 PM.

vBulletin © 2020, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI