Thread Tools Display Modes
06-23-22, 07:24 AM   #1
Firesong
A Deviate Faerie Dragon
Join Date: Jan 2022
Posts: 19
Question 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?
  Reply With Quote
06-24-22, 02:09 AM   #2
Firesong
A Deviate Faerie Dragon
Join Date: Jan 2022
Posts: 19
Question

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.
  Reply With Quote
06-24-22, 06:27 AM   #3
plusmouse
A Defias Bandit
Join Date: Jun 2021
Posts: 2
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.
  Reply With Quote
06-26-22, 03:52 AM   #4
Firesong
A Deviate Faerie Dragon
Join Date: Jan 2022
Posts: 19
Exclamation

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

WoWInterface » Developer Discussions » Lua/XML Help » Key Bindings Puzzle

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