Quantcast
WoWInterface - View Single Post - Save default keybinding in Keybinding UI
View Single Post
09-11-20, 11:02 PM   #2
Walkerbo
A Flamescale Wyrmkin
 
Walkerbo's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 142
Hi all

After playing around for a while I decided to approach this problem in a different way.

I now check to see if the keybinding is set, if not I add it.

It does not write it to the bindings-cache.wtf file; instead it sets it upon login and /reload.

Here is my function;
Lua Code:
  1. local function ensureDefaultKeybinds()
  2.     local key1, key2
  3.     key1,key2 = GetBindingKey("AVKRUNADDITEMTOGLOBALLISTFUNCTION")
  4.     if not key1 and not key2 then
  5.         SetBinding("ALT-F9","AVKRUNADDITEMTOGLOBALLISTFUNCTION")
  6.     end
  7.     key1,key2 = GetBindingKey("AVKRUNADDITEMTOCHARACTERLISTFUNCTION")
  8.     if not key1 and not key2 then
  9.         SetBinding("ALT-F10","AVKRUNADDITEMTOCHARACTERLISTFUNCTION")
  10.     end
  11.     key1,key2 = GetBindingKey("AVKRUNADDITEMTOGLOBALPROTECTLISTFUNCTION")
  12.     if not key1 and not key2 then
  13.         SetBinding("ALT-F11","AVKRUNADDITEMTOGLOBALPROTECTLISTFUNCTION")
  14.     end
  15.     key1,key2 = GetBindingKey("AVKRUNADDITEMTOCHARACTERPROTECTLISTFUNCTION")
  16.     if not key1 and not key2 then
  17.         SetBinding("ALT-F12","AVKRUNADDITEMTOCHARACTERPROTECTLISTFUNCTION")
  18.     end
  19. end

This is most likely the nasty/inefficient solution but it gets me to where I need to be.

Any advice or better solutions would be great, but if not I will just keep playing with this and report back when/if I find a better solution.

Cheers
__________________
"As someone once told me, frames are just special types of tables, and tables are special types of pointers."
Fizzlemizz
  Reply With Quote