WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Key Bindings Puzzle (https://www.wowinterface.com/forums/showthread.php?t=59155)

Firesong 06-23-22 07:24 AM

Key Bindings Puzzle
 
https://wowpedia.fandom.com/wiki/API_GetBinding

I've all my keys set to default.

The code sample for me just prints "Movement Keys > Turn Right (TURNRIGHT) is bound to: " So GetBinding is getting nothing.

https://wowpedia.fandom.com/wiki/API_GetBindingByKey

I have "Blade of Justice" on 1.

bindingAction = GetBindingByKey("1")
print(bindingAction) prints nil

Can anyone tell me what I am doing wrong? Is there a WoW settting that is needed for GetBinding or GetBindingByKey to work?

Firesong 06-24-22 02:09 AM

I have left J mapped to guild panel. Copying the code from the example I have:
Code:

key = "J"
bindingAction = GetBindingByKey(key)
print(bindingAction)

It prints 'nil' every time. No error. I'm baffled.

plusmouse 06-24-22 06:27 AM

I'm guessing you're calling
Code:

GetBindingByKey(key)
when the client's loading starts. The keybinds information isn't available immediately, you need to wait for the
Code:

VARIABLES_LOADED
event.

Running your code in-game after login and loading gets the right keybinding for me.

Firesong 06-26-22 03:52 AM

Wow - thanks. I did indeed run it from a little addon I use to test things and the code was the first line.


All times are GMT -6. The time now is 06:31 AM.

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