Thread Tools Display Modes
Prev Previous Post   Next Post Next
08-25-08, 01:06 PM   #1
BDelacroix
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Jan 2006
Posts: 33
2.x Secure State Headers

I have been beating my head against this brick wall for a week now.

I'm working on trying to get this mod to work and then I'll try to understand the 3.0 changes.

I am down to just guessing now and that's getting nowhere very quickly.

Yes, I'm told that this will be easier with 3.x. I don't see that as being comforting since I can't find much about it beyond Iriel's documentation. Perhaps I'm just an idiot, but I don't think so.

So, what is the obvious thing I've done in the below code?

I'll tell you what it does do. I get the button I create. I can right and left click in the parent frame to change the state. That piece of code isn't in the box below. What does not happen is, at no time does a spell ever get cast. The button just presses and animates. No error message. No attempt to cast the spell I thought I associated with any of the virtual buttons.

The spell names are spelled right as I can change this up to a normal secure button without states and it casts nicely. I just can't change what the button does in combat.

All the examples I've seen only use secureactionbarbutton. That has functionality I don't want. Namely its tied to action buttons. Perhaps changing spells per state is not allowed.

Code:
	ntraps=trapper:enumeratetraps()
	if ntraps then
-- Create buttons for each trap
			trap_b = CreateFrame("Button","trapper_button",trapper,"ActionButtonTemplate,SecureActionButtonTemplate")

-- set state spell attributes &
-- build statebutton string

			statestring="1:S1"
			for t = 1, ntraps do
				if t>1 then
					statestring=statestring..";"..t..":S"..t
				end
			end
			trap_b:SetAttribute("statebutton",statestring)

-- Set possible states
			trap_b:SetAttribute("newstate","1-"..ntraps..":=")
			
-- Set type and spell for each state
			for t = 1, ntraps do
				trap_b:SetAttribute("type1-S"..t,"spell")
				trap_b:SetAttribute("spell-S"..t,trap_n[t])
			end

-- add this button as a child of the state header
			trapper:SetAttribute("addchild",trab_b)

-- set the state to "1"
			trap_b:SetAttribute("state","1")

			trap_b:SetScript("OnAttributeChanged", TrapButton_Update)

-- Set the image for the button
			trap_b:SetNormalTexture(trap_i[1])
			trap_b:SetPushedTexture(trap_i[1])
  Reply With Quote
 

WoWInterface » Developer Discussions » General Authoring Discussion » 2.x Secure State Headers


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