Thread Tools Display Modes
12-12-15, 06:58 PM   #1
saxitoxin
A Theradrim Guardian
 
saxitoxin's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 60
secure actionbutton macrotext and modifiers

How do I add a modifier to a secure actionbutton macrotext?

what I want to do is make my mount macro into a addon, but I cant get the [mod] command to read

mount macro code
Code:
#showtooltip
/cancelform
/leavevehicle
/stopcasting
/cast [mod:shift] Traveler's Tundra Mammoth ; [mod:ctrl] Azure Water Strider ; [mod:alt] Obsidian Nightwing
/run if SecureCmdOptionParse"[nomod]"then C_MountJournal.Summon(0)end
my testcode to see that [mod] is not working

yes, I know that I should post the entire code, but it is such a horrible mess right now so I made this one instead to describe my problem
Lua Code:
  1. local HSframe = CreateFrame("BUTTON","homeButton", UIParent, "SecureActionButtonTemplate")
  2. HSframe:SetPoint("CENTER")
  3. HSframe:SetSize(42, 16)
  4. HSframe:EnableMouse(true)
  5. HSframe:RegisterForClicks("AnyUp")
  6. HSframe:SetAttribute("type1", "macro")
  7. HSframe:SetAttribute("macrotext", "/use [mod] item:128353; item:6948")
  8.  
  9. HSframe.icon = HSframe:CreateTexture(nil,"OVERLAY",nil,7)
  10. HSframe.icon:SetSize(16, 16)
  11. HSframe.icon:SetPoint("LEFT")
  12. HSframe.icon:SetTexture(1,1,0)
  13.  
  14. HSframe.text = HSframe:CreateFontString(nil, "OVERLAY")
  15. HSframe.text:SetFont(STANDARD_TEXT_FONT, 16, "THINOUTLINE")
  16. HSframe.text:SetPoint("RIGHT")
  17. HSframe.text:SetText("HS")
  Reply With Quote
12-12-15, 07:57 PM   #2
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
It doesn't work because SetAttribute("type1", "macro") explicitly means it's only a "macro" for unmodified left-clicks, you probably just want "type" in there (or "*type1" for any left-clicks).
  Reply With Quote
12-16-15, 01:22 AM   #3
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Just use "type" without any numbers, asterisks, or modifiers.

Code:
local button = CreateFrame("Button", "MyAwesomeMountButton", nil, "SecureActionButtonTemplate")
button:SetAttribute("type", "macro")

button:SetAttribute("macrotext", [[
     /cancelform
     /leavevehicle
     /stopcasting
     /cast [mod:shift] Traveler's Tundra Mammoth ; [mod:ctrl] Azure Water Strider ; [mod:alt] Obsidian Nightwing
     /stopmacro [mod]
     /run C_MountJournal.Summon(0)
]])

-- add visual stuff here

SetOverrideBinding(button, false, "CTRL+`", "CLICK MyAwesomeMountButton:LeftButton")
See also:
https://github.com/Phanx/MountMe/blob/master/Addon.lua
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » secure actionbutton macrotext and modifiers


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