WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   Bug with SetBinding and SaveBindings? (https://www.wowinterface.com/forums/showthread.php?t=58654)

Vinnesta 03-29-21 12:02 PM

Bug with SetBinding and SaveBindings?
 
In my addon, I am trying to set a keybind for a function using the following two lines of code:

SetBinding("CTRL-G", "SOME_ACTION")
SaveBindings(GetCurrentBindingSet())

However when loading this code, the keybind profile automatically switches to the character-specific key bindings (from the account-wide profile I was using before). In addition, all the keybinds in the character profile are not bound to anything, i.e. it resets to an entirely blank profile, except for the command that I just bound with the code.

I have disabled every addon and made a test addon with literally just these two lines of code, and yet I still get this behavior.

Note that GetCurrentBindingSet() returns 1 (i.e. account keybindings) right before SetBinding() is called. I have also tried setting a mode of 1 or 2 in SetBinding, but it does not help.

Is anyone getting the same issue in 9.0.5?

UPDATE: I believe I have fixed this issue by loading the code only after the player is logged in - when using AceAddon this would be in the OnEnable() method, or alternatively by checking IsLoggedIn(). The problem is likely caused by the addon initializing before the keybinds are fully loaded by the game client.


All times are GMT -6. The time now is 12:48 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI