Xonotic Forums
[SOLVED] Numbers key don't work with azerty keyboards - Printable Version

+- Xonotic Forums (https://forums.xonotic.org)
+-- Forum: Support (https://forums.xonotic.org/forumdisplay.php?fid=3)
+--- Forum: Xonotic - Help & Troubleshooting (https://forums.xonotic.org/forumdisplay.php?fid=4)
+--- Thread: [SOLVED] Numbers key don't work with azerty keyboards (/showthread.php?tid=3635)



Numbers key don't work with azerty keyboards - Thuban - 10-31-2012

Hi,
I don't know if it is a bug or a specific problem with my computer.
When I try to map the "number keys" to each weapons, xonotic doesn't recognize some.
As I'm french, I have an azerty keyboard, and the key not recognized are :
- é (2)
- è (7)
- ç (9)
- à (0)

Is there any way to fix it, or is it a bug?

Oh, and I use Xonotic 0.6, but the same problem is present in last git build. (at least the 31/10)


RE: Numbers key don't work with azerty keyboards - Mr. Bougo - 10-31-2012

Indeed, this is a problem. Keyboard input in DarkPlaces (the engine Xonotic uses) is broken by design because it's american-centric, dealing with only ASCII characters and the usual special keys. See this bug report.

There is a workaround but it's rather unstable. The thing with the keys you are trying to bind is that they are not ASCII characters, but they are still in the latin1 range. For some reason I forgot (perhaps because it's still single-byte encoding so the config can be read,) DarkPlaces still recognizes latin1 characters in bind commands when they are read from a config file. But there's a problem with this (that you might not notice), in that some latin1 characters lie in ranges of internal key codes that is also used by special keys. So, if you manage to bind a non-ASCII latin1 character's key, the bind might be shared with a special key such as page up/down, home/end, perhaps the F keys, and others (maybe even the keypad keys?)

Anyway, if you still want to give it a try, here's how you can bind those latin1 keys. First you need to create the autoexec.cfg file in your personal data directory if it does not exist yet. That directory is located somewhere in your personal documents directory and depends on your OS. The easiest way to figure it out is to open the Xonotic console (shift escape, works in the menu as well as ingame) and type which config.cfg in there. This will locate the config.cfg file which lives in the personal data directory. So, next to that config.cfg file, create an autoexec.cfg file.

Then, you want to put your binds in there. For example,
Code:
bind "é" +jump
bind "à" "say I just pressed my a-grave key"
Now, this is important, you need to save this file with a latin1 encoding. In some text editors you can pick the encoding in the "save as" dialog, in some others you have to set the encoding for the file somewhere in the menus. Use a better text editor if yours does not seem to let you pick the encoding. This matters, because utf-8 just won't work.

Don't hesitate to ask for help if you're having trouble with this. I'm also fluent in French if that can help.


RE: Numbers key don't work with azerty keyboards - Thuban - 11-01-2012

Thank you, things worked great!
Here is what I've done.
I just edited the file ~/.xonotic/data/config.cfg (I used vim and there was no problem with encoding, lucky), and added as Mr Bougo suggested these lines :
Code:
bind QUOTE "weapon_group_3"
bind & "weapon_group_1"
bind APOSTROPHE "weapon_group_4"
bind ( "weapon_group_5"
bind - "weapon_group_6"
bind _ "weapon_group_8"
bind à "weapon_group_0"
bind ç "weapon_group_9"
bind è "weapon_group_7"
bind é "weapon_group_2"
And since now, everything seems to work fine.

Thank you!


RE: Numbers key don't work with azerty keyboards - Mr. Bougo - 11-01-2012

config.cfg works too, but this sort of config is better in autoexec.cfg I think. There's no risk of overriding the binds and having to go into a text editor to type them back Smile

Do it the way you like it, it doesn't really matter Smile


RE: Numbers key don't work with azerty keyboards - Thuban - 11-01-2012

No problem yet, but if any override happens, I'l know what to do.
Thank you very much! Smile


RE: Numbers key don't work with azerty keyboards - Mr. Bougo - 11-01-2012

Oh, that's not what I meant. The thing with config.cfg is that it's rewritten every time you close the game, so it's not the best place to add permanent customization. It still works, but that's why I suggested autoexec.cfg instead.