Thread Tools Display Modes
08-13-08, 03:47 PM   #1
Ingensu
A Fallenroot Satyr
 
Ingensu's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 22
Secure Templates?

I'm trying to integrate a targeting function into my mod--To my understanding, this is possible with a secure template, and there's another thread that I read that talked about the LUA involved... But how exactly do I add a secure frame, and where do I add the code to alter its attributes? I want it to target a unit from a variable, and to my understanding, that's possible (as shown in http://www.wowinterface.com/forums/s...ad.php?t=17360 ), but I still don't know how to add a secure frame--when I tried and used that code (with a different unit's name, of course) nothing happened when I tried to call the function. I'm a bit confused.
  Reply With Quote
08-13-08, 03:59 PM   #2
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
Could you please show you current code?
  Reply With Quote
08-13-08, 04:15 PM   #3
Ingensu
A Fallenroot Satyr
 
Ingensu's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 22
I don't really have one. e_e I did, and I deleted it in the end, but it shouldn't be relevant... My question was how to do it, not to have my code fixed. I don't understand where I need to put the attribute-altering code in order for it to work. Look at the thread I linked--I was trying to emulate that with a different unit name.

I created a frame that inherited SecureFrameTemplate and tried to make a button that did this OnClick:

Code:
local foo = " Ingensu";
ThisIsMySecureFrame:SetAttribute("type1", "macro")
ThisIsMySecureFrame:SetAttribute("macrotext", "/target" ..foo)
  Reply With Quote
08-13-08, 04:16 PM   #4
schnoggo
A Fallenroot Satyr
 
schnoggo's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2006
Posts: 20
You can "target" during combat, but you cannot change the unit that you're trying to target during combat.

I've done it (well Assist actually) by setting the macro text of a button and calling that - gives you all targeting options of using a macro.

Last edited by schnoggo : 08-13-08 at 04:18 PM.
  Reply With Quote
08-13-08, 04:19 PM   #5
Ingensu
A Fallenroot Satyr
 
Ingensu's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 22
I'm aware. But this didn't work while I was out of combat. I clicked the button and got no errors, but nothing happened either.
  Reply With Quote
08-13-08, 04:20 PM   #6
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
There is not OnClick-Handler for secure frames. The "OnClick action" is defined by the attributes.
You could set the attributes at any time. (if you are not in combat lockdown)

You'll find a secure frames overview here: http://www.wowwiki.com/Secure_frames_overview
  Reply With Quote
08-13-08, 04:21 PM   #7
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
Originally Posted by schnoggo View Post
but you cannot change the unit that you're trying to target during combat
You can. Have a look at secure group headers.

Edit: At least in some degree.

Last edited by Duugu : 08-13-08 at 04:24 PM.
  Reply With Quote
08-13-08, 04:23 PM   #8
Ingensu
A Fallenroot Satyr
 
Ingensu's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 22
I read the overview and tried to make what sense I could out of that.

My overall goal is this: To store a unit's name while out of combat, then when a key binding is pressed, to target that stored unit. I do not need to change the unit-to-be-targeted while in combat, the code I posted was meant as a test of concept so I could integrate it better. The button did not inherit a secure template, nor was it inside of a secure frame. It was only meant to be a placeholder for the keybinding I was to integrate later.
  Reply With Quote
08-13-08, 04:27 PM   #9
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
Well ... I'm sorry. I won't write down the code for you nor won't write down a secure template tutorial. I'll provide some help with tangible problems if there are any.

Last edited by Duugu : 08-13-08 at 04:29 PM.
  Reply With Quote
08-13-08, 04:38 PM   #10
Ingensu
A Fallenroot Satyr
 
Ingensu's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 22
I came here hoping to get a more clear understanding of how to use a secure template. Nothing I found on WoW Wiki (and I spent a good two hours trying to learn everything I could) gave me any good idea of how to attempt what I'm doing--I thought I found what I was after with that thread that I linked. And I had, but I'm only looking for clarification--this thread contains no XML for the secure frame, or what they were using to call the code they posted, and clearly one of those two things is the problem with what I attempted.

I'm sorry I can't be clearer. Or that I'm in over my head. I won't deny that I'm new to this. That's why I'm asking for help. And everywhere I look I'm not getting any. :\
  Reply With Quote
08-13-08, 04:58 PM   #11
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
The xml stuff is almost like any other.

Code:
<Button name="TargetButton" inherits="SecureButtonTemplate">
  [size, anchors, whatever]
  <Attributes>
    <Attribute name="type" value="macro"/>
    <Attribute name="macro" value="/target somename"/>
  </Attributes>
</Button>
You could also set the attributes wherever in you code ... if you are out of combat.

Code:
TargetButton:SetAttribute("type", "macro")
TargetButton:SetAttribute("macrotext", "/target somename")
As stated before you don't need any OnClick handler.
  Reply With Quote
08-13-08, 05:15 PM   #12
Ingensu
A Fallenroot Satyr
 
Ingensu's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 22
As I said, I'm new to this. I added that code to my testing AddOn, and I'm still not having success--when should this target the named unit? I changed "somename" to Ingensu, obviously, but I'm not sure how to make it actually target?

That is, I haven't seen anything new added, and I'm unsure how to make it target from there :\

Last edited by Ingensu : 08-13-08 at 05:18 PM.
  Reply With Quote
08-13-08, 05:26 PM   #13
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
Originally Posted by Ingensu View Post
when should this target the named unit?
On every click.

Edit: I just realized that you try to target a unit without any hardware event (click, key press, whatever). Is that true? That's not possible.
  Reply With Quote
08-13-08, 05:29 PM   #14
Ingensu
A Fallenroot Satyr
 
Ingensu's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 22
Every click on the button? Because I don't see one. I think I might be doing something wrong. >.<

My intent is to have it target a saved unit on a key binding. I was going to integrate that later, after I had the actual targeting aspect down. Take it one step at a time, as it were.
  Reply With Quote
08-13-08, 05:35 PM   #15
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
The code below isn't complete. Did you noticed the [size, anchors, whatever]
part? Are you familiar with xml, frames, etc. at least?
Could be a good idea to read a (xml) addon tutorial first.
  Reply With Quote
08-13-08, 05:42 PM   #16
Ingensu
A Fallenroot Satyr
 
Ingensu's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 22
I understand it's not complete. It's within a frame in the appropriate tags to my understanding (I have another button in the frame that shows up just fine). But I don't see that button. :\ Clearly my XML is at fault. I'll take a closer look.

Edit: The inherit is causing it to go invisible for some reason--if I remove the SecureActionButtonTemplate and replace it with UIPanelButtonTemplate, the button shows up where expected.

Last edited by Ingensu : 08-13-08 at 05:45 PM.
  Reply With Quote
08-13-08, 05:54 PM   #17
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
As stated before: please show you code
  Reply With Quote
08-13-08, 05:57 PM   #18
Ingensu
A Fallenroot Satyr
 
Ingensu's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 22
Sorry.

This was largely set up with AddOn studio as far as the main layout--I added the secure button manually. For all I know, that's the problem, AddOn studio likes to mess with the XML when I'm not looking.

Code:
	<Frame name="Frame1" parent="UIParent" toplevel="true" movable="true" enableMouse="true">
		<Size>
			<AbsDimension x="259" y="149" />
		</Size>
		<Anchors>
			<Anchor point="TOPLEFT">
				<Offset>
					<AbsDimension x="100" y="-158" />
				</Offset>
			</Anchor>
		</Anchors>
		<Backdrop bgFile="Interface\DialogFrame\UI-DialogBox-Background" edgeFile="Interface\DialogFrame\UI-DialogBox-Border" tile="true">
			<BackgroundInsets>
				<AbsInset left="11" right="12" top="12" bottom="11" />
			</BackgroundInsets>
			<TileSize>
				<AbsValue val="32" />
			</TileSize>
			<EdgeSize>
				<AbsValue val="32" />
			</EdgeSize>
		</Backdrop>
		<Frames>
			<Button name="TargetSelfButton" inherits="SecureActionButtonTemplate" text="First Aid">
				<Size x="100" y="20" />
				<Anchors>
					<Anchor point="TOPLEFT">
						<Offset x="17" y="-29" />
					</Anchor>
				</Anchors>
				<Attributes>
					<Attribute name="type" value="macro" />
					<Attribute name="macro" value="/target Ingensu" />
				</Attributes>
			</Button>
		</Frames>
	</Frame>
  Reply With Quote
08-13-08, 06:26 PM   #19
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
Post

It is there. You just can't see it. SecureActionButtonTemplate has no visuals elements as default.
Add a backdrop to you button and you'll see it.
  Reply With Quote
08-13-08, 06:32 PM   #20
Ingensu
A Fallenroot Satyr
 
Ingensu's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 22
Ah! Thank you! Now I have to turn that into a keybinding. To my understanding, that's also done through attributes as well?

I'm really sorry if I seem a bit newbie-ish...I am a newbie, after all. I know that can be really frustrating to deal with.

EDIT: I've successfully made it target and bound it to a key! It's working exactly how I want it to. Thank you so much for your help, Duugu!

Last edited by Ingensu : 08-13-08 at 08:35 PM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Secure Templates?


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