Quantcast
WoWInterface - View Single Post - Creating Secure Action Buttons + Keybinding them
View Single Post
05-27-19, 11:49 AM   #4
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 1,979
Originally Posted by CrittenxD View Post
How efficient is a list of 60x /use item if only item 60 is in the inventory? Does the Blizzard code for /use item iterate through the whole inventory for each item?
Whatever happens in C code is hidden to us. What we do know is /use is the same as /cast and tells the game to use an ability/item by name. On our end, it's the quickest and most efficient way to do this. If any iteration needs to happen, C code is magnitudes faster at doing it than Lua.



Originally Posted by CrittenxD View Post
Does "RegisterForClicks("AnyDown");" check for every single button press if it was R?
This tells the ActionButton which mouse buttons it should listen for. The keybind sends a click event to the ActionButton and it processes the request thinking the user clicked on it.



Originally Posted by CrittenxD View Post
How do I bind the button through the key bindings menu? I tried a bunch of different ways to get the CLICK MyMacroButton in there but I am not familiar with xml at all.
Code:
<Binding name="USEITEM"  >(whatdoIwritehere?)</Binding>
To get around the Protected Function issue, what we did is create a protected button which Blizzard supplied a template for us to use and configure to perform the action we want. To trigger the protected button we made, we have to use the built-in CLICK binding command. Unintuitively, you use this command as the name of the binding. You can't define any Lua code within the <Binding> tag anymore when doing this, it will be ignored.
Code:
<Binding name="CLICK MyActionButton"/>
If you wish to have the entry come up with a custom name, you need to write it to a specific global in your one of your Lua files.
Code:
_G["BINDING_NAME_CLICK MyActionButton"]="Run My Macro";
Note: This global has to be the same name as your binding (this is the CLICK command we set) prefixed by BINDING_NAME_.



Originally Posted by CrittenxD View Post
One more thing I ran into is changing the loot key from shift to alt. In my bindings-cache.wtf there is a line 'modifiedclick ALT AUTOLOOTTOGGLE', but how do I do this via SetBinding or something similar?
This is handled in Interface Options, not Keybindings.
__________________
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)

Last edited by SDPhantom : 05-27-19 at 11:52 AM.
  Reply With Quote