Thread Tools Display Modes
08-28-14, 04:42 AM   #1
Xíry
A Murloc Raider
Join Date: Aug 2014
Posts: 4
Extra focus target addon

I'm playing assa rogue in pve and I want to keep rolling rupture on multiple targets. In arena its easy with /arena1,2,3 but theres no such an option in pve which is - of course - understandable. Therefore having just one focus frame isn't enough for me.

First, i want to create a really simple addon that can communicate with macros and can register multiple targets.
My idea is that when I targeting an enemy and typing /starget focus the addon saves the target name into a variable. When I type /starget target the addon send a chat message which will look like a simple targeting macro command with the target's name. (/tar targetname)

I was able to create a working code but it doesn't do as I expected. It sends the chat message /tar targetname, but the full command is visible like when you type a space before a macro when you want to send it to someone. Of course theres no space before the command. Is it possible to target that way? Or is there a completely different method?

Here is the code:
Code:
SLASH_STARGET1, SLASH_STARGET2 = '/star', '/starget';
local function handler(msg, editBox)
    if msg == 'focus' then
		target1 = UnitName('Target')
		print("Target 1 saved: " .. target1)
    elseif msg =='target' then
		SendChatMessage("/tar " .. target1)
    end
end
SlashCmdList["STARGET"] = handler;
I know this way you can only target npcs who have got individual name. How could I store the target if there would be more than 1 npc with the same name in my range?

In the future I'd like to create an ui for the addon where you can set up keybinds so you won't need to create macros. I also want to expand the addon with the option of casting spells on target (like /cast [target=target1] spellname) so I also want to give an ability to choose what spell to use on the starget.

Thanks in advance,
Xíry
  Reply With Quote
08-28-14, 07:39 AM   #2
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Xíry View Post
My idea is that when I targeting an enemy and typing /starget focus the addon saves the target name into a variable. When I type /starget target the addon send a chat message which will look like a simple targeting macro command with the target's name. (/tar targetname)
The general idea would be possible, but you would not be able to set, unset, or change the target while in combat. The addon "Battleground Targets" may be of some use as an example.

However, the specific idea of sending a dynamic "/tar <name>" chat command is not possible at all -- targeting a unit by any means, including by a slash command, is a secure action and requres a hardware event and a secure chain of execution. An addon sending a chat command automatically -- even if it's in response to you typing a different command -- cannot perform a secure action. You may want to take a look at the "Things addons/macros can't do" sticky thread.

The only way to do this would be using a secure action button set to run a "/tar <name>" macro (you could activate the button using a key binding, a slash command, or by clicking on it) but as mentioned above, you would not be able to change the name while in combat.

Originally Posted by Xíry View Post
I know this way you can only target npcs who have got individual name. How could I store the target if there would be more than 1 npc with the same name in my range?
You can't. There's no way to target a unit other than by name or unit token (eg. to target the party3 unit). If multiple NPCs have the same name, there's no way to specify which of them "/tar name" will target. Generally I think, whichever one is closest to you will be targeted.
__________________
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
08-28-14, 07:58 AM   #3
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
What if one sets up a new secure unit frame as a child of the target frame and then sets the childs unit attribute (or whatever the attributes name with the secure unit frame is) on ... let's say a alt+right click .. to the current unit name of the target frame?

Shouldn't that work in combat?

It would require two clicks of course. First to target the new unit and second to set it to the additional focus frame.

Last edited by Duugu : 08-28-14 at 08:01 AM.
  Reply With Quote
08-28-14, 12:17 PM   #4
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Maybe. It wouldn't work the way described in the OP, though, as there's just no way to make custom slash commands perform secure actions, and it still wouldn't help with targeting a specific NPC when multiple have the same name. I also don't think it would really help with the situation described -- keeping a debuff up on multiple mobs in PVE. For this, you'd be better off just adding debuff icons to nameplates; then you have both the information and a "click to target this exact mob even if it shares a name with the other 10 mobs in the pack" frame right in the same place.
__________________
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

WoWInterface » Developer Discussions » Lua/XML Help » Extra focus target addon


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