Page 1 of 1

[Solved] How to bind the § key?

Posted: 08 Jan 2011, 17:38
by meriton
I have a keyboad in locale de-ch, where the key left of 1 is labeled §. I am trying to bind it to the drawinmap command, so far without success.

So far, I tried:
1. In springsettings.exe -> hotkeys tab -> commands -> general :click on drawinmap
2. click into "New Shortcut", press the § key -> § appears
3. click add, save config

uikeys.txt then contains:

Code: Select all

bind		5		drawinmap
This doesn't seem right, because it tries to rebind the 5 key rather than §. Indeed, when I press § in game, nothing happens.

I also tried to manually edit uikeys.txt with

Code: Select all

bind		§		drawinmap
Still, nothing happens when I press § in game.

Re: How to bind the § key?

Posted: 08 Jan 2011, 17:44
by Beherith
First you have to unbind the originals, like so:

Code: Select all

unbind              Any+`  drawinmap
unbind              Any+\  drawinmap
unbind           Any+0xa7  drawinmap
Then

Code: Select all

bind Any+§ drawinmap

Re: How to bind the § key?

Posted: 08 Jan 2011, 17:53
by meriton
That didn't work either (nothing happens when I press the key in game). I suspect it's because spring doesn't know what keycode the character § corresponds to. Unfortunately, neither do I.

Re: How to bind the § key?

Posted: 08 Jan 2011, 18:19
by Beherith
That character does not seem to be in the ascii table. You might want to try switching input locales to english before game.

Re: How to bind the § key?

Posted: 08 Jan 2011, 18:59
by meriton
That's cumbersome in windows as far as I can tell. I don't want to change the system default, and switching it for an application requires me to see the task bar (bye bye fullscreen mode), or press a keyboard shortcut (Alt-Shift or Ctrl-Shift) I frequently use for other stuff and have therefore disabled.

It would therefore be helpful though if Spring supported binding non-ascii keys as well.

I think I'll stick to the default keymapping then (where the ä key is bound to drawinmap).

Re: How to bind the § key?

Posted: 08 Jan 2011, 19:12
by aegis
you could use something like autohotkey to bind § to ` outside of spring

Re: How to bind the § key?

Posted: 08 Jan 2011, 20:34
by very_bad_soldier
Please try this in your uikeys.txt:

Code: Select all

bind Any+/ drawinmap
Not sure if it will work though.

Re: How to bind the § key?

Posted: 08 Jan 2011, 21:30
by trepan
excerpt from uikeys.txt:

Code: Select all

//
//  Extra Run-Time Commands
//
//    /keyload   : loads the uikeys.txt bindings  (does not clear current bindings)
//    /keyreload : loads the uikeys.txt bindings  (clears current bindings first)
//    /keysave   : save current bindings to 'uikeys.tmp'  (NOTE: 'tmp' vs. 'txt')
//    /keysyms   : prints the known keysyms to standard out
//    /keycodes  : prints the known keycodes to standard out
//    /keyprint  : prints the current bindings to standard out
//    /keydebug  : prints debugging information to standard out (for each keystroke)
//
That last command may be of interest
(assuming that spring's code still supports it).

Re: How to bind the § key?

Posted: 08 Jan 2011, 22:21
by SirMaverick
It does.

Use /keydebug to see what key spring is seeing when you press a button.
e.g.:
known key:
GetAction: enter (0x00D)
unknown key:
GetAction: 0x138 (0x138)

As explained in uikeys.txt you can define new keys and add commands as usual.
keysym SomeNameForYourKey 0x138
bind SomeNameForYourKey drawinmap

Re: How to bind the § key?

Posted: 09 Jan 2011, 03:58
by meriton
Thanks a lot Trepan and SirMaverik, that worked like a charm. BTW, I had to use a pure ASCII symbolic key name (with § as symbolic name, the key was not bound).

This thread is now linked from the wiki page on keyboard bindings.

PS: It's still weird that springsettings.exe would write an incorrect entry into uikeys.txt, though.