Thread Tools Display Modes
02/15/20, 09:05 PM   #1
ShadowMau
AddOn Author - Click to view addons
Join Date: Oct 2018
Posts: 23
Help with keybindings not loading

I have been trying to figure this out, and it is probably something very simple that I am missing. I am writing a very simple addon the provides an example of how to add a keybind to controls. I have looked at several other addons as examples, and have gone so far as to copy and paste the content into my file. It still will not work. It appears that either my xml file has an error of some kind that I am missing, or the xml file is not loading at all. I have completely exited the client and launcher, and restarted the game in case that was causing an issue.

I have gone in to other people's addons and made changes (ie: adding my own command identical to what I am trying to accomplish in my addon). Those changes show up in the controls list and allow me to assign a key. When pressed, the key works as expected. I then copied the changed bindings.xml file back to my addon directory, trimmed the original out so all am left with is what I had added. Again it will not work (even though the exact same file worked in the other directory).

Thinking that my bindings.xml file was corrupted somehow, I have re-created the file several times. Have saved it as a plain txt file, then renamed it, and used copy and paste as well as just typing it all in fresh. Nothing is making any progress. I am using Notepad++ as my editor. However I have also recreated the files using the built in Windows notepad as well.

I added a slash command so I can check to make sure that my string id's are actually created. I tried a different string name (Yes I left the old one in) just in case I was colliding with some other addon or reserved keywords. Using the slash command, it shows that the string assignments have been made. Everything checks out, but the option does not show up under the controls. I used the color codes to make it show up more clearly, and the same color codes work fine when I modify other people's bindings.xml files. It is probably something stupid-simple, but what am I missing??


SimpleKeybind.txt
Code:
; This Add-on is not created by, affiliated with or sponsored by ZeniMax Media
; Inc. or its affiliates. The Elder Scrolls and related logos are registered
; trademarks or trademarks of ZeniMax Media Inc. in the United States and/or
; other countries. All rights reserved.
; https://account.elderscrollsonline.com/add-on-terms

## Title: |cff0000SimpleKeybind|r
## Description: Simple example keybind to get it to work
## Author: |cff38ffShadowMau|r
## Version: 0.0.1
## APIVersion: 100029


SimpleKeybind.lua
bindings.xml

SimpleKeybind.lua
Code:
SimpleKeybind = {}
SimpleKeybind.name = "SimpleKeybind"

local function simplekeybindtester()
	d("Simple Keybind Slash Command Test")
	d("Binding Name: " .. GetString(SI_BINDING_NAME_SKTEST))
	d("Eagle Binding: " .. GetString(SI_BINDING_NAME_EAGLE))
	d("Keybinding Layer: " ..GetString(SI_KEYBINDINGS_LAYER_GENERAL))
end


function SimpleKeybind.OnAddOnLoaded(event, addonName)
	if addonName == SimpleKeybind.name then
		ZO_CreateStringId("SI_BINDING_NAME_SKTEST", "|cEECA2ASimple Keybind|r")
		ZO_CreateStringId("SI_BINDING_NAME_EAGLE", "|cEECA2AEagle|r")
		SLASH_COMMANDS["/skt"] = simplekeybindtester

	
		-- No need to check any more
		EVENT_MANAGER:UnregisterForEvent(SimpleKeybind.name, EVENT_ADD_ON_LOADED)
	end
end

EVENT_MANAGER:RegisterForEvent(SimpleKeybind.name, EVENT_ADD_ON_LOADED, SimpleKeybind.OnAddOnLoaded)
bindings.xml
Code:
<Bindings>
	<Layer name="SI_KEYBINDINGS_LAYER_GENERAL">
		<Category name="|cEECA2ASimpleKeybind|r">
			<Action name="EAGLE">
				<Down>UseCollectible(267)</Down>
			</Action>
		</Category>
	</Layer>
</Bindings>

Last edited by ShadowMau : 02/15/20 at 09:09 PM. Reason: Fixed a spelling error
  Reply With Quote
02/16/20, 02:40 AM   #2
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,566
Don't think you are missing anything. I just copy pasted your code into files and it works just fine. Either you have missed something in the way you posted it, or you are simply overlooking the keybind in the menu.
Try to compare the attached version to your own with something like WinMerge. Maybe there are some unseen differences like a utf8 BOM.
Attached Files
File Type: zip SimpleKeybind.zip (1.5 KB, 407 views)
  Reply With Quote
02/16/20, 11:14 AM   #3
ShadowMau
AddOn Author - Click to view addons
Join Date: Oct 2018
Posts: 23
Originally Posted by sirinsidiator View Post
Don't think you are missing anything. I just copy pasted your code into files and it works just fine. Either you have missed something in the way you posted it, or you are simply overlooking the keybind in the menu.
Try to compare the attached version to your own with something like WinMerge. Maybe there are some unseen differences like a utf8 BOM.


Thank you so much for looking at it. I admire your work and feel honored you took the time to look at my issue. I downloaded the zip file you attached, installed your debug addons (thank you), deleted my directory, pasted in the one from the zip file, reloaded game, and it worked perfectly. Which makes me think there is an encoding problem somewhere. I think Notepad++ is using regular utf8. Are we supposed to be using something else? And why do all the other files work, and only that one specific binding file causing the problem?

Anyway, it is working now. Now I have to figure out what is going on so my next attempt will not have the same issue.
  Reply With Quote
02/16/20, 11:59 AM   #4
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,903
I had problems with the encoding of the txt files as well. The txt files should be just ANSI and the lua files utf-8 without any byte order mark.
At least this is what always works for me so far.
If the txt files are also utf-8 w or w/o BOM the addon manager sometimes does not recognize them (on live servers at least).

I also had a problem with the ingame addon manager which wasn't loading txt files of addons and libraries if the first line in the txt file was not empty. But this was an older error (like 3 years ago) and maybe this isn't the case anymore today.
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » Help with keybindings not loading

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