Creating Secure Action Buttons + Keybinding them
Hi, I am a noob at scripting and I'm struggling to create a secure action button so I can use something along the lines of UseContainerItem or UseItemByName. I also would like to use this button via a Keybind in the Key Bindings options.
I got some code which I tried to use on my keybind resulting in a popup saying that I'm trying to use a protected function: Code:
function UseItem() |
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:
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 |
Alright, so I shamelessly copied your frame and ran SetBindingClick("R", "MyMacroButton") and it works.
A few more questions did arise from this: 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? Does "RegisterForClicks("AnyDown");" check for every single button press if it was R? 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> 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? |
Quote:
Quote:
Quote:
Code:
<Binding name="CLICK MyActionButton"/> Code:
_G["BINDING_NAME_CLICK MyActionButton"]="Run My Macro"; Quote:
|
Thanks again, everything is now working as desired. It was CLICK MyActionButton:LeftButton, btw.
I still got a few CVars which don't seem to pop up in either the character or account settings in the WTF folder, and I checked the ALT setting for auto loot again and it is definitely saved in bindings-cache and none of the two config-cache gets modified when changing that setting. It should be a CVar, but I think it might be some sort of weird exception and I have no idea how to modify it via the api. Probably gonna make a thread about this in a few days in case I don't make any progress on that front. |
Quote:
https://wow.gamepedia.com/API_SetModifiedClick |
Awesome. Gonna play for a few days before I'll look at the addon again. Fortunately I'm running out of things to fix though, thanks again.
|
All times are GMT -6. The time now is 10:40 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI