Quantcast
WoWInterface - View Single Post - Creating Secure Action Buttons + Keybinding them
View Single Post
05-26-19, 09:49 PM   #2
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 1,977
Using a SecureActionButtonTemplate, if you set type to "macro", you can set a string to macrotext that'll let you run it as a macro with unlimited length.
https://wow.gamepedia.com/SecureActionButtonTemplate

Example:
Lua Code:
  1. local MacroButton=CreateFrame("Button","MyMacroButton",nil,"SecureActionButtonTemplate");
  2. MacroButton:RegisterForClicks("AnyUp");--   Respond to all buttons
  3. MacroButton:SetAttribute("type","macro");-- Set type to "macro"
  4. MacroButton:SetAttribute("macrotext","/use Hearthstone\n/say Using my Hearthstone.");-- Set our macro text

This creates a button named MyMacroButton that can be activated by using the CLICK MyMacroButton binding command.
https://wow.gamepedia.com/Creating_key_bindings
https://wow.gamepedia.com/API_SetBinding
__________________
ESOUI AddOns | WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote