Thread Tools Display Modes
07-25-08, 07:02 PM   #1
Jaffy
A Deviate Faerie Dragon
 
Jaffy's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 16
Targeting via SecureFrames

Ok, I've created a button to do a should-be-simple task: target a unit.

The problem is, I cant figure out how to target a unit thats derived from a saved variable or local (ill explain in a second).

(for the following, im trying to target a guy named Lar in Sen'jin Village)

It works if the target is built into the macro, such as this:

Code:
self:SetAttribute("type1", "macro")
self:SetAttribute("macrotext", "/target Lar")
It dosnt work though if the target comes from a local:

(SUPERTARGET is used for a lack of a better name atm)

Code:
local SUPERTARGET = "Lar";
self:SetAttribute("type1", "macro")
self:SetAttribute("macrotext", "/target" ..SUPERTARGET)
I tried it with a different attribute type, but that didnt work either:

Code:
local SUPERTARGET = "Lar";
self:SetAttribute("type", "target")
self:SetAttribute("unit", "Lar")
So, does anybody have any idea on how to get this to work?
  Reply With Quote
07-25-08, 07:52 PM   #2
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
So, does anybody have any idea on how to get this to work?
Your can't.
afaik the attribute "unit" must be a UnitID. A unit name is not valid. (however I'm not 100% sure about that)


Edit:
Your second example should work. Just add a space before the name:
Code:
local SUPERTARGET = " Lar";

Last edited by Duugu : 07-25-08 at 08:14 PM.
  Reply With Quote
07-25-08, 10:08 PM   #3
Jaffy
A Deviate Faerie Dragon
 
Jaffy's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 16
Holy crap, works like a charm. Thanks a bunch man!
  Reply With Quote
07-25-08, 10:31 PM   #4
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Yeah - before you had /targetLar
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Targeting via SecureFrames

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