number of key bindings
So everyone wants key bindings on my SWAPS Addon and more presets... In theory I want to make an unlimited set of presets which can be attached to a key binding of your choice. I got everything done except the key bindings. Its looking really awesome.
I have yet to really play with key bindings but this should be possible correct? Or am I going to run into a problem with a fixed amount? |
Quote:
But no, I'm afraid this probably won't be possible -- when you define new keybindings, you have to do them in XML, and I don't know of a way to do it programmatically or dynamically. So you're limited to the keybinds you define in advance. Am I explaining this clearly? |
I just did my first addon keybindings yesterday (for OmniStats), and it's pretty well laid out in AddOn Quick Questions on the wiki how to do it.
Unless there's other ways of doing it, katkat42 is correct in that you have to define your keybindings in advance (in bindings.xml and bindings.lua). |
Quote:
Yeah thats kind of what I was kind of grasping from the wiki. I guess to be clear with my question I wanted to make dynamic key bindings with lua and no xml. In my SWAPS addon, I made it so you can make an unlimited number of skill presets but everyone wanted key bindings to a preset. My idea was to set a keybinding as you make a skill preset. Which meant you can make any preset bound until you run out of keyboard keys. So based on what you said, dynamic keybinding might not be possible. |
So dynamically defining Keybinds is not possible, I got that.
But what about dynamically assigning the keybind up/down callbacks? Anybody got an idea where I could find the list/table of Keybindings? /zgoo _G has no obvious entry I could find. Say, I make Keybinds 1-5 in XML but without any callback. Maybe I even tell them not to be shown by default (so they only show after I assigned a callback), if possible. Then I dynamically assign the callbacks to each binding from code, till I run out of bindings or things to assign. |
Quote:
Lua Code:
Later, you can re-define the functions, because lua treats functions like just another variable: Lua Code:
Does this seem like it would work? |
All times are GMT -6. The time now is 07:55 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI