Thread Tools Display Modes
Unread 07-11-09, 01:12 PM   #1
Rhamses
A Theradrim Guardian
Join Date: Jun 2009
Posts: 61
xml button, left and right?

I have an addon with a button defined in XML. It is registered for OnClick.

I have tried to remap with OnClick(self, "button", down)

<cit>LeftButton</cit>

<cit>RightButton</cit>

But The closest I can get is changing the reply to the left button only rather than both. I have also tried to remap while in lua with

ExecuteWarning_Pet_BuffFrame:SetAttribute('type1', 'spell')
ExecuteWarning_Pet_BuffFrame:SetAttribute('spell', "Health Funnel")
ExecuteWarning_Pet_BuffFrame:SetAttribute('type2', 'spell')
ExecuteWarning_Pet_BuffFrame:SetAttribute('spell', "Life Tap")


that does not work. It will only life tap. If I flip flop it will only life funnel.

I am sure I can make a work around, but I am also trying to learn as I go.

thanks,
Rhamses
Rhamses is offline  
Unread 07-11-09, 01:22 PM   #2
spiel2001
nUI's Author
 
spiel2001's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2008
Posts: 7,724
I may be wrong, but I think the problem is that "spell" isn't what's it's doing, it's a label for what action to take. Try this...

Code:
ExecuteWarning_Pet_BuffFrame:SetAttribute('type1', 'leftSpell')
ExecuteWarning_Pet_BuffFrame:SetAttribute('leftSpell', "Health Funnel")
ExecuteWarning_Pet_BuffFrame:SetAttribute('type2', 'rightSpell')
ExecuteWarning_Pet_BuffFrame:SetAttribute('rightSpell', "Life Tap")
I caution I may be misunderstanding how that mechanism works, myself.
__________________

What people don't get is that I am, ultimately, an artist at heart.
My brush has two colors, 1 and 0, and my canvas is made of silicon.



Official nUI Web Site: http://www.nUIaddon.com
Official nUI Support Forum: http://forums.nUIaddon.com
My day job: http://www.presidio.com/
spiel2001 is offline  
Unread 07-11-09, 01:48 PM   #3
Rhamses
A Theradrim Guardian
Join Date: Jun 2009
Posts: 61
Unfortunetly, it did not work. With the original this:RegisterForClicks("AnyUp");

Maybe I will try and combine the alternate lua and xml.

Interestingly, if I set two attributes, (type1 and type2) it always cast the type2 spell. If I -- out the type1 atribute it will only cast the type2 spell with button2.

ExecuteWarning_Pet_BuffFrame:SetAttribute('type1', 'spell')
ExecuteWarning_Pet_BuffFrame:SetAttribute('spell', "Health Funnel")
ExecuteWarning_Pet_BuffFrame:SetAttribute('type2', 'spell')
ExecuteWarning_Pet_BuffFrame:SetAttribute('spell', "Life Tap")

= Life tap both buttons

--ExecuteWarning_Pet_BuffFrame:SetAttribute('type1', 'spell')
--ExecuteWarning_Pet_BuffFrame:SetAttribute('spell', "Health Funnel")
ExecuteWarning_Pet_BuffFrame:SetAttribute('type2', 'spell')
ExecuteWarning_Pet_BuffFrame:SetAttribute('spell', "Life Tap")

= Life tap on btn2 only

ExecuteWarning_Pet_BuffFrame:SetAttribute('type1', 'spell')
ExecuteWarning_Pet_BuffFrame:SetAttribute('spell', "Health Funnel")
--ExecuteWarning_Pet_BuffFrame:SetAttribute('type2', 'spell')
--ExecuteWarning_Pet_BuffFrame:SetAttribute('spell', "Life Tap")

= Health Funnel btn1 only
Rhamses is offline  
Unread 07-11-09, 01:57 PM   #4
spiel2001
nUI's Author
 
spiel2001's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2008
Posts: 7,724
THe problem is that when you call SetAttribute() the value on the left is the attribute that you're setting (the name or lValue) and the value on the right is what you are setting it to ( the value, or rValue). So...

ExecuteWarning_Pet_BuffFrame:SetAttribute('spell', "Health Funnel")

is setting the value of "spell" to "Health Funnel" in the same way that

spell = "Health Funnel"

would work.

So, when you then call

ExecuteWarning_Pet_BuffFrame:SetAttribute('spell', "Life Tap")

you are *changing* spell = "Health Funnel" to spell = "Life Tap"

In order for what you want to work to work, you have to have "type1" and "type2" reference two different spells... and I can't recall the mechanism to do that off hand.
__________________

What people don't get is that I am, ultimately, an artist at heart.
My brush has two colors, 1 and 0, and my canvas is made of silicon.



Official nUI Web Site: http://www.nUIaddon.com
Official nUI Support Forum: http://forums.nUIaddon.com
My day job: http://www.presidio.com/
spiel2001 is offline  
Unread 07-11-09, 02:21 PM   #5
Rhamses
A Theradrim Guardian
Join Date: Jun 2009
Posts: 61
Ok, I see now. I made the assumption that it was like mapping [btn:1] in a macro and the two lines of code were linked. I do not have 'spell' defined as a local. But, you are right, it sure is behaving that way.

rham
Rhamses is offline  
Unread 07-11-09, 02:26 PM   #6
spiel2001
nUI's Author
 
spiel2001's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2008
Posts: 7,724
It's not that spell is defined as a global, a local or anything like that, it's that it is how it is treated by the secure code engine. Attributes are just names with values the same as a variable is a name with a value.

So, yeah, you have to figure out how to map left button and right button to two different action attributes.
__________________

What people don't get is that I am, ultimately, an artist at heart.
My brush has two colors, 1 and 0, and my canvas is made of silicon.



Official nUI Web Site: http://www.nUIaddon.com
Official nUI Support Forum: http://forums.nUIaddon.com
My day job: http://www.presidio.com/
spiel2001 is offline  
Unread 07-11-09, 03:29 PM   #7
Xrystal
nUI User and Supporter
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,027
I think, if memory serves right, I saw code that had spell show up as spell1 and spell2 to match the type1 and type2 lines. Then you refer to spell1 for one spell and spell2 for another. Think I used cryolysis for my examples when doing the portal addon.
__________________
Xrystal is offline  
Unread 07-11-09, 04:51 PM   #8
Rhamses
A Theradrim Guardian
Join Date: Jun 2009
Posts: 61
Ok, here is my work around. I am calling type1 a 'spell' and type2 as 'macro'

ExecuteWarning_Pet_BuffFrame:SetAttribute('type', 'spell')
ExecuteWarning_Pet_BuffFrame:SetAttribute('spell', "Health Funnel")
ExecuteWarning_Pet_BuffFrame:SetAttribute('type2', 'macro')
ExecuteWarning_Pet_BuffFrame:SetAttribute('macrotext', '/cast Life Tap')


Rhamses
Rhamses is offline  
Unread 07-11-09, 05:09 PM   #9
spiel2001
nUI's Author
 
spiel2001's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2008
Posts: 7,724
Just out of curiousity... following on Xrystal's comment... does this work...

ExecuteWarning_Pet_BuffFrame:SetAttribute('type', 'spell')
ExecuteWarning_Pet_BuffFrame:SetAttribute('spell1', "Health Funnel")
ExecuteWarning_Pet_BuffFrame:SetAttribute('type2', 'spell')
ExecuteWarning_Pet_BuffFrame:SetAttribute('spell2', 'Life Tap')
__________________

What people don't get is that I am, ultimately, an artist at heart.
My brush has two colors, 1 and 0, and my canvas is made of silicon.



Official nUI Web Site: http://www.nUIaddon.com
Official nUI Support Forum: http://forums.nUIaddon.com
My day job: http://www.presidio.com/
spiel2001 is offline  
Unread 07-11-09, 05:24 PM   #10
Rhamses
A Theradrim Guardian
Join Date: Jun 2009
Posts: 61
ExecuteWarning_Pet_BuffFrame:SetAttribute('type', 'spell')
ExecuteWarning_Pet_BuffFrame:SetAttribute('spell1', "Health Funnel")
ExecuteWarning_Pet_BuffFrame:SetAttribute('type2', 'spell')
ExecuteWarning_Pet_BuffFrame:SetAttribute('spell2', 'Life Tap')

Does work! This will open the possibilities to use the other button. It may also help me parse "harmbutton1" from

http://www.wowwiki.com/SecureActionButtonTemplate

As I am still trying to learn, the examples are not the best.

Rhamses
Rhamses is offline  
 

Go BackWoWInterface » Featured Projects » nUI, MozzFullWorldMap and PartySpotter » Customization » nUI: Developer Chat » xml button, left and right?

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