Thread Tools Display Modes
03-08-18, 11:59 PM   #1
ilion
A Murloc Raider
Join Date: Mar 2018
Posts: 4
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!

Last edited by ilion : 03-09-18 at 01:59 AM.
  Reply With Quote
03-09-18, 02:56 AM   #2
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
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...
__________________
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
03-09-18, 09:25 AM   #3
ilion
A Murloc Raider
Join Date: Mar 2018
Posts: 4
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.
  Reply With Quote
03-09-18, 10:51 AM   #4
ilion
A Murloc Raider
Join Date: Mar 2018
Posts: 4
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?
  Reply With Quote
03-09-18, 11:31 AM   #5
Ammako
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 256
Originally Posted by ilion View Post
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?
Originally Posted by Phanx View Post
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.)

Last edited by Ammako : 03-09-18 at 11:41 AM.
  Reply With Quote
03-09-18, 12:18 PM   #6
ilion
A Murloc Raider
Join Date: Mar 2018
Posts: 4
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
  Reply With Quote
03-09-18, 12:56 PM   #7
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
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.
  Reply With Quote
03-09-18, 02:20 PM   #8
MunkDev
A Scalebane Royal Guard
 
MunkDev's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 431
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')
__________________

Last edited by MunkDev : 03-09-18 at 02:26 PM.
  Reply With Quote
03-09-18, 02:29 PM   #9
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
Originally Posted by MunkDev View Post
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).
  Reply With Quote
03-09-18, 02:38 PM   #10
MunkDev
A Scalebane Royal Guard
 
MunkDev's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 431
Originally Posted by semlar View Post
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?
__________________
  Reply With Quote
03-09-18, 02:46 PM   #11
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
Originally Posted by MunkDev View Post
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.

Last edited by semlar : 03-09-18 at 03:24 PM.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Search/Requests » Addon for selecting assigning specific targets

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