WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Secure actionbutton macro with binding (https://www.wowinterface.com/forums/showthread.php?t=56339)

robertito54321 07-07-18 05:28 PM

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


p3lim 07-08-18 02:44 AM

You could use spell instead of macro and set the unit to player.

robertito54321 07-08-18 03:47 AM

Quote:

Originally Posted by p3lim (Post 328561)
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?

robertito54321 07-08-18 06:18 AM

Quote:

Originally Posted by robertito54321 (Post 328563)
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.


All times are GMT -6. The time now is 01:55 PM.

vBulletin © 2018, Jelsoft Enterprises Ltd
© 2004 - 2017 MMOUI