WoW:SecureActionButtonTemplate: Difference between revisions

Line 47: Line 47:


===action===
===action===
Executes an action. Calls UseAction(self:GetAttribute("action"), 1, self:GetAttribute("unit"))
Executes an action. Calls UseAction(action, unit, button)
 
<br />
<br />
'''Attributes:'''
'''Attributes:'''
Line 55: Line 56:
| action
| action
| (integer) The action slot to execute
| (integer) The action slot to execute
|-----
| unit
| (unitid) The unit to perform that action on. Defaults to player's target.
|}
|}


Line 71: Line 75:
| action
| action
| (integer) The pet action slot to execute
| (integer) The pet action slot to execute
|-----
| unit
| (unitid) The unit to perform that action on. Defaults to player's target.
|}
|}


Line 86: Line 93:
|-----
|-----
| spell
| spell
| The name of the spell to cast. For example, "Flash Heal".
| (string) The name of the spell to cast. For example, "Flash Heal".
|-----
| unit
| (unitid) The unit to cast the spell on. Defaults to player's target.
|}
|}


Line 109: Line 119:
| item
| item
| String specifying the item name. May be used instead of a bag/slot combo. Will not be used if "slot" is set.
| String specifying the item name. May be used instead of a bag/slot combo. Will not be used if "slot" is set.
|-----
| unit
| (string unitid) Unit to use that item on. Defaults to player's target.
|}
|}


Line 129: Line 142:
{| border="1" style="border-collapse: collapse;" cellpadding="4"
{| border="1" style="border-collapse: collapse;" cellpadding="4"
|-
|-
| macro || (unknown) Identifier specifying the macro to execute. Does this take a macro name or ID (testing needed)?
| macro || (string or integer) Identifier specifying the macro to execute. This takes macro name or id.
|-
|-
| macrotext || (string) Macro text to be executed.
| macrotext || (string) Macro text to be executed.
Line 138: Line 151:
  frame:SetAttribute("type1", "macro")
  frame:SetAttribute("type1", "macro")
  frame:SetAttribute("macro1", 1)  
  frame:SetAttribute("macro1", 1)  
Note: Yes, the macro attribute takes either a Macro Name or ID - Jaycyn


Causes this frame to run a macro that announces the player's target.
Causes this frame to run a macro that announces the player's target.
Line 149: Line 159:


===stop===
===stop===
Cancels a spell if you are targeting a spellcast.
Cancels spell targeting.
<br />
<br />
'''Attributes:'''
'''Attributes:'''
Line 169: Line 179:
* Otherwise, targets the unit.
* Otherwise, targets the unit.
<br />
<br />
'''Attributes:'''
'''Attributes:'''
'''Attributes:'''


{| border="1" style="border-collapse: collapse;" cellpadding="4"
{| border="1" style="border-collapse: collapse;" cellpadding="4"
|-----
|-----
| ''None''
| unit
| (string unitid) This button's unit. Defaults to player's target.
|}
|}
  frame:SetAttribute("type", "target")
  frame:SetAttribute("type", "target")
-----
-----
Line 186: Line 199:
{| border="1" style="border-collapse: collapse;" cellpadding="4"
{| border="1" style="border-collapse: collapse;" cellpadding="4"
|-----
|-----
| ''None''
| unit
| (string unitid) This button's unit. Defaults to player's target.
|}
|}


Line 200: Line 214:
{| border="1" style="border-collapse: collapse;" cellpadding="4"
{| border="1" style="border-collapse: collapse;" cellpadding="4"
|-----
|-----
| ''None''
| unit
| (string unitid) This button's unit. Defaults to player's target.
|}
|}


Line 221: Line 236:
  frame:SetAttribute("type", "click")
  frame:SetAttribute("type", "click")
  frame:SetAttribute("clickbutton", myOtherButton)
  frame:SetAttribute("clickbutton", myOtherButton)
-----
===attribute===
Sets attribute for arbitrary frame.
<br />
'''Attributes:'''
{| border="1" style="border-collapse: collapse;" cellpadding="4"
|-----
| attribute-frame
| The frame to set attribute for. Defaults to this frame.
|-----
| attribute-name
| Attribute name.
|-----
| attribute-value
| Attribute value.
|}
Clicking this button will call MyOtherButton:SetAttribute("unit","focus").
frame:SetAttribute("type", "attribute")
frame:SetAttribute("attribute-frame", MyOtherButton)
frame:SetAttribute("attribute-name","unit")
frame:SetAttribute("attribute-value","focus")
-----
-----


Line 244: Line 282:
FrameXML/SecureTemplates.lua offers this documentation:
FrameXML/SecureTemplates.lua offers this documentation:


The "modified attribute" takes the form of: modifier-name-button. The modifier is one of "shift-", "ctrl-", "alt-", and the button is a number from 1 through 5.
The "modified attribute" takes the form of: modifier-name-button. The modifier is one of "alt-", "ctrl-", "shift-", or combination of them in '''''this''''' order, and the button is a number from 1 through 5 or hyphen followed custom button name mapped through some means.
* Note that modifiers have to appear in order "alt-ctrl-shift-" to function, if you mess the order that attribute will only consume memory for nothing.


For example, you could set an action that is used for unmodified left click like this:
For example, you could set an action that is used for unmodified left click like this:
Anonymous user