Thread Tools Display Modes
12/04/14, 08:17 AM   #1
SnowmanDK
 
SnowmanDK's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 161
Any way to find keybinds?

Hi
As I have set up so you can add keybindings to Bank Manger Revived, then I wonder if it's possible to detect what keys have been set from inside the addon.

Example:
Transfer Gold F2

I would like to be able to add that key (F2) to the tooltip on the button for the gold transfer, so it would read something like:
Gold (F2)

Is this possible?
I did try and go through the API but can't seem to find anything...
  Reply With Quote
12/04/14, 12:12 PM   #2
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
It should be something like this:

Lua Code:
  1. local actionName = "BMR_GOLD_TRANSFER"
  2. local layerIndex, categoryIndex, actionIndex = GetActionIndicesFromName(actionName)
  3. local bindingIndex = 1 --1 or 2, primary or secondary binding
  4.  
  5. local keyCode, mod1, mod2, mod3, mod4 = GetActionBindingInfo(layerIndex, categoryIndex, actionIndex, bindingIndex)
  6.  
  7. --I assume that you use bindings without modifier keys (ALT, CTRL, SHIFT, COMMAND), so this example uses just keyCode
  8. d(zo_strformat("Action |cFFFFFF<<1>>|r is bound to |cFFFFFF<<2>>|r.", actionName, GetKeyName(keyCode)))

Or you can use a bit more complex function defined in the UI which prints also modifier keys (I'd prefer this method):
Lua Code:
  1. local actionName = "BMR_GOLD_TRANSFER"
  2.  
  3. --KEYBIND_TEXT_OPTIONS_ABBREVIATED_NAME = 1
  4. --KEYBIND_TEXT_OPTIONS_FULL_NAME = 2
  5. --KEYBIND_TEXT_OPTIONS_FULL_NAME_SEPARATE_MODS = 3
  6. local textOptions = KEYBIND_TEXT_OPTIONS_ABBREVIATED_NAME
  7.  
  8. --KEYBIND_TEXTURE_OPTIONS_NONE = 1
  9. --KEYBIND_TEXTURE_OPTIONS_EMBED_MARKUP = 2
  10. local textureOptions = KEYBIND_TEXTURE_OPTIONS_NONE
  11.  
  12. local bindingIndex = 1  --1 or 2, primary or secondary binding
  13.  
  14. local bindingString = ZO_Keybindings_GetBindingStringFromAction(actionName, textOptions, textureOptions, bindingIndex)
  15.  
  16. d(zo_strformat("Action |cFFFFFF<<1>>|r is bound to |cFFFFFF<<2>>|r.", actionName, bindingString))

Last edited by Garkin : 12/04/14 at 12:14 PM.
  Reply With Quote
12/06/14, 04:43 PM   #3
SnowmanDK
 
SnowmanDK's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 161
Thanks, didn't know I can use modifiers. I guess they are pretty rare, or at least very limited
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » Any way to find keybinds?

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