Thread Tools Display Modes
04-20-14, 04:41 PM   #1
IndigoThinker
A Defias Bandit
Join Date: Apr 2014
Posts: 3
Trying to set target via LUA code.

I am unable to use this protected LUA function in WoW.

Lua Code:
  1. TargetUnit("nameExample");

So I tried the alternative below.

Lua Code:
  1. btn = CreateFrame("Button","myButton",UIParent,"SecureActionButtonTemplate");
  2. btn:SetAttribute("type","target");
  3. btn:SetAttribute("unit","nameExample");
  4. btn:Click("yo");

Same problem.

Is there anyway to set target via LUA without getting blocked?

Thanks in advance.
  Reply With Quote
04-20-14, 05:23 PM   #2
Smashbolt
A Deviate Faerie Dragon
Join Date: Mar 2010
Posts: 13
As far as I know, there is not. Like you said, targeting is protected; it can only be done by an addon in response to a physical hardware event.

So your button in example 2 should target just fine if it's actually clicked by the player (I think), but clicking it programmatically won't work.
  Reply With Quote
04-20-14, 05:45 PM   #3
IndigoThinker
A Defias Bandit
Join Date: Apr 2014
Posts: 3
How about calling a macro that is defined as
Code:
/target exampleName
  Reply With Quote
04-20-14, 05:47 PM   #4
IndigoThinker
A Defias Bandit
Join Date: Apr 2014
Posts: 3
or maybe set the button i used to call the script and just press it twice?
  Reply With Quote
04-21-14, 04:43 AM   #5
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Not possible. You cannot automatically set your target, run a macro, or click a secure button. See the Things Addons/Macros Can't Do sticky thread. All of the actions you've mentioned require a hardware event -- a button press or mouse click. An addon cannot do them for you.
__________________
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 » AddOns, Compilations, Macros » AddOn Help/Support » Trying to set target via LUA code.


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