Quantcast
SetBinding issues - WoWInterface
Thread Tools Display Modes
02-13-20, 02:07 AM   #1
doofus
A Flamescale Wyrmkin
Join Date: Feb 2018
Posts: 138
SetBinding issues

Hello.

I have used SetBinding to tie keystrokes to macros. These are saved in bindings-cache.wtf.

If I change the binding key of a macro, the old binding is still present in this file, and I cannot get rid of it, or know what other bindings this macro has. The only solution is to manually delete bindings-cache.wtf.

Is there an API I can use to delete all bindings present for a specific macro ?

Thanks
  Reply With Quote
02-13-20, 06:02 PM   #2
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 1,975
You can send nil as (or completely omitt) the second argument to SetBinding() to remove the key from all bindings.

I don't know if GetBinding() works on custom bindings. It might not.
__________________
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 : 02-13-20 at 06:10 PM.
  Reply With Quote
02-16-20, 03:52 AM   #3
doofus
A Flamescale Wyrmkin
Join Date: Feb 2018
Posts: 138
Thank you, however it is the opposite function I need,

1) delete all key-bindings for a specific macro without knowing how many bindings exit for that macro
2) delete all key-bindings for all macros
  Reply With Quote
02-17-20, 05:11 PM   #4
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 1,975
Originally Posted by doofus View Post
Thank you, however it is the opposite function I need,

1) delete all key-bindings for a specific macro without knowing how many bindings exit for that macro
2) delete all key-bindings for all macros
Reiterating:
Originally Posted by SDPhantom View Post
I don't know if GetBinding() works on custom bindings. It might not.
On another note, if you know the command string, you might try GetBindingKey(), but like the other function, I don't know if this works on custom bindings. If neither of them do, then you're out of luck. That's all the API has for iterating through permanent ones.

There is a series of functions for override bindings, but that's a completely different system.
__________________
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
09-05-20, 07:02 AM   #5
doofus
A Flamescale Wyrmkin
Join Date: Feb 2018
Posts: 138
On a similar note, I have a few macros like

Macro : "BOB"
/cast [@mouseover] MySpell

and then
SetBinding("F1", "MACRO BOB");

Due to limited number of macros, is there a way to use SetBinding in a way similar to the pseudo-code below, so as to avoid creating a macro?

-- this does not work
SetBinding("F1", "/cast [@mouseover] MySpell");
  Reply With Quote
09-05-20, 06:37 PM   #6
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 1,975
Nope. The only way around it is to write addon code to create an ActionButton, then have the binding click it.

I'd probably use SetOverrideBinding*() so it doesn't clutter Bindings.wtf. The first argument to these functions is the binding's owner. This lets you manage bindings as a group. For example, you can use ClearOverrideBindings() to remove all bindings that are owned by a frame.
Lua Code:
  1. local Button=CreateFrame("Button","AddOnName_ButtonName",nil,"SecureActionButtonTemplate");
  2. Button:SetAttribute("type","macro");
  3. Button:SetAttribute("macrotext","/cast [@mouseover] MySpell");
  4. SetOverrideBindingClick(Button,"F1","AddOnName_ButtonName");
__________________
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 : 09-05-20 at 07:03 PM.
  Reply With Quote
09-06-20, 03:58 PM   #7
doofus
A Flamescale Wyrmkin
Join Date: Feb 2018
Posts: 138
OK that worked thanks.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » SetBinding issues

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