Quantcast Secure actionbutton macro with binding - WoWInterface
Thread Tools Display Modes
07-07-18, 05:28 PM   #1
robertito54321
A Murloc Raider
Join Date: Aug 2012
Posts: 8
Secure actionbutton macro with binding

How can I set a binding to a button through secure code that will only trigger on itself?

I have it kinda working with 'SetBindingClick' but it also triggers outside of the button...
I basically want the button to execute the macro when I hover over it and press 'NUMPAD2'

Example secure snippet
Code:
self:SetAttribute("type", "macro")
self:SetAttribute("macrotext", [[/cast [@player] Effuse]])

--self:SetBindingClick(false, "NUMPAD2", self, self:GetName()) --works, but also works outside the btn :/
--self:SetBinding(false, "NUMPAD2", "MACRO mymacro") --doesnt work
--self:SetBindingMacro(false, "NUMPAD2", "mymacro")  --doesnt work
  Reply With Quote
07-08-18, 02:44 AM   #2
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,669
You could use spell instead of macro and set the unit to player.
  Reply With Quote
07-08-18, 03:47 AM   #3
robertito54321
A Murloc Raider
Join Date: Aug 2012
Posts: 8
Originally Posted by p3lim View Post
You could use spell instead of macro and set the unit to player.
For a simple macro body like the one I posted, yes this could work.
Unfortunately the macro is more complicated than what I posted (my bad for not saying this before), so setting the type to 'spell' wont work in my case.

Any other ideas?
  Reply With Quote
07-08-18, 06:18 AM   #4
robertito54321
A Murloc Raider
Join Date: Aug 2012
Posts: 8
Originally Posted by robertito54321 View Post
For a simple macro body like the one I posted, yes this could work.
Unfortunately the macro is more complicated than what I posted (my bad for not saying this before), so setting the type to 'spell' wont work in my case.

Any other ideas?

Managed to make it work by inheriting from 'SecureHandlerEnterLeaveTemplate',
and changing the bindings based on the values of _onevent and _onleave attributes.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Secure actionbutton macro with binding

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