Binding simple keys from LUA - WoWInterface
Thread Tools Display Modes
06-17-19, 04:34 AM   #1
A Flamescale Wyrmkin
Join Date: Feb 2018
Posts: 148
Binding simple keys from LUA

I have observed the following:

The key bindings are stored in "D:\Games\World of Warcraft\_retail_\WTF\Account\XYZ\bindings-cache.wtf"

If you reset all your key bindings to default, then this file gets deleted or is empty

If you make a simple change, eg set ' to be action bar 5, it then creates this file with
bind 5 NONE


I usually set my special/extra key bindings using the standard UI. It then creates the bindings-cache.wtf file. For example I set "shift 1" to be "bottom left action button 1" which inserts another entry to the bindings-cache.wtf file:

I wanted to set those key bindings from my addon in LUA. I then did this:


However this does not work as imagined. I have not got to the bottom of it yet. I have observed that right after a character reload it works fine, I can press Shift-1 and get the action expected. If I then go the key-bindings UI, the multiactionbar section appears empty and even if I ESC out of it, it has now "lost" my Shift-1 binding, until another /reload or login, and then the shift-1 works just fine, as long as I do not visit the key-bindings UI.

No other addons are loaded.

Could someone please help me understand this?
  Reply With Quote
06-17-19, 07:10 AM   #2
A Scalebane Royal Guard
MunkDev's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 431
You're not saving your bindings. On login, and when opening the keybinding UI, it loads your current binding set using LoadBindings(set), where set is:

In order to make your bindings stay in place across sessions, you have to use SaveBindings(set).
Alternatively, if you don't want to permanently store your bindings, run your code in response to the UPDATE_BINDINGS event.

Last edited by MunkDev : 06-17-19 at 07:13 AM.
  Reply With Quote
06-17-19, 12:22 PM   #3
A Flamescale Wyrmkin
Join Date: Feb 2018
Posts: 148
OK, currently I load my bindings during the PLAYER_LOGIN event. I will use the save function then to make sure but will still load my bindings during every PLAYER_LOGIN just to be sure.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Binding simple keys from LUA

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