Thread Tools Display Modes
04/07/14, 02:05 PM   #1
tiomun
 
tiomun's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 25
Key Binding?

So I have a really nice control I created id like to add key binding options to the Controls > Keybindings interface, and also have them preset with defaults. Obviously from a saved variable, but the commands to do this have been hard to find. I searched here and the api docs a few times with no luck. I was wondering if anyone had any tips on this? I know at least one addon had options for keybinding, but I don't remember which one so it will take me a while to find a example to learn from.

Also is there a way to see if a key is held down?
  Reply With Quote
04/07/14, 02:39 PM   #2
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 648
http://wiki.esoui.com/AddOn_Quick_Qu...an_tie_into.3F
  Reply With Quote
04/07/14, 05:41 PM   #3
tiomun
 
tiomun's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 25
Excellent thank you
  Reply With Quote
04/08/14, 06:48 AM   #4
tiomun
 
tiomun's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 25
So having some issues with this.

bindings.xml
Code:
<Bindings>
	<Layer name="|cFF8C00Rive|r Mouse Mod">
		<Category name="General Options">
			<Action name="RMM_MOUSE_MOD_ENABLE">
				<Down>RMM_ToggleEnabled()</Down>
			</Action>
		</Category>
	</Layer>
</Bindings>
Bindings.lua
Lua Code:
  1. ZO_CreateStringId("SI_BINDING_NAME_RMM_MOUSE_MOD_ENABLE", "Toggle Mouse Mod on/off")

This part seems to work as far as adding options to the keybindings menu..

function in main lua file
Lua Code:
  1. function RMM_ToggleEnabled()
  2.     rmm_data.AddonEnabled = not rmm_data.AddonEnabled
  3.     if rmm_data.AddonEnabled == false then
  4.         d("Disabled " .. rmm_name)
  5.     else
  6.         d("Enabled " .. rmm_name)
  7.     end
  8. end

in txt file
Code:
RiveMouseMod.lua

lib/LibStub/LibStub.lua
lib/LibAddonMenu-1.0/LibAddonMenu-1.0.lua

bindings/bindings.xml
bindings/Bindings.lua
RiveMouseMod.xml
So the issue is, when I assign a key to bind it doesn't seem to fire the function in the main lua file...
Not sure why its not working. Even comparing it to other addons it looks fine, I think.

Also is there a way to set a default key to be bound?
  Reply With Quote
04/08/14, 02:57 PM   #5
tiomun
 
tiomun's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 25
Ok I figured it out.

Code:
<Bindings>
	<Layer name="|cFF8C00Rive|r Mouse Mod"> <--Must be "General"
		<Category name="General Options"><-- Must be to Addon name
			<Action name="RMM_MOUSE_MOD_ENABLE">
				<Down>RMM_ToggleEnabled()</Down>
			</Action>
		</Category>
	</Layer>
</Bindings>
So with the corrections

Code:
<Bindings>
	<Layer name="General">
		<Category name="|cFF8C00Rive|r Mouse Mod">
			<Action name="RMM_MOUSE_MOD_ENABLE">
				<Down>RMM_ToggleEnabled()</Down>
			</Action>
		</Category>
	</Layer>
</Bindings>
Which stinks! It looked cool having its own heading!
  Reply With Quote
04/12/14, 08:52 AM   #6
tiomun
 
tiomun's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 25
Still Need Default Key Bind help!!!

So I have created a really nice bag interface. and the above keybinding settings work well. However, there is a conflict between opening the default inventory, and opening my inventory.



The issue is, the default inventory is bound to B and I. If the user only binds B to my addon and hits I the default inventory still opens and steals back its children. This is avoidable if both B and I are bound to my addon. It would also improve the ease of use for my addon. I always like to reduce the amount of user configuration required for my projects.

I need to find how to set my addon to have default keys bound to it. I do not want to use the xml onKeyDoan method listed here http://wiki.esoui.com/AddOn_Quick_Qu...an_tie_into.3F since it does not allow for a user to change the keys to open the interface. pluss I havnt been able to get it to not make the rest of the game unresponsive (which I believe is the point when a tlc is open).

I have been through zgoo and the wikki many times now, and not found anything that would indicate a means of defining a default key for a control. I have been trying to get this working for the majority of the last week without any success.

Any help would be greatly appreciated.
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » Key Binding?


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