• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Keyboard shortcuts not working on Ubuntu that work on Windows

I've cross-compiled my game for Ubuntu, but the keyboard shortcuts don't appear to be working quite the same. I have an if statement in my player option's Step event:

if keyboard_check_pressed(186) and keyboard_check(vk_shift)

This is intended to be a shortcut on the colon : key. Instead, when this key is pressed, nothing happens. Also, the key press I have for the 9 key (not the numpad, next to Backspace) instead seems to correspond to the down arrow key. Additionally, the numpad keys do not work as arrow keys, regardless of whether numlock is on or off.
 
Last edited:

Nocturne

Friendly Tyrant
Forum Staff
Admin
Have you tried not hard-coding the colon to 186 and instead use the actual character? Eg:

GML:
if keyboard_string == ":" && keyboard_check_pressed(vk_shift)
{
// do something
}
keyboard_string = "";
Keyboard input varies across platforms, so hard-coding a value is NOT a good idea. If you check on this chart you'll see that your 186 value is actually 59 on Ubuntu and will also change depending on different language keyboards... In general you want to ALWAYS avoid hard-coding any input to a value as you never know what language a user has their keyboard set to, and you also can't guarantee the same value across platforms.
 
Have you tried not hard-coding the colon to 186 and instead use the actual character? Eg:

GML:
if keyboard_string == ":" && keyboard_check_pressed(vk_shift)
{
// do something
}
keyboard_string = "";
Keyboard input varies across platforms, so hard-coding a value is NOT a good idea. If you check on this chart you'll see that your 186 value is actually 59 on Ubuntu and will also change depending on different language keyboards... In general you want to ALWAYS avoid hard-coding any input to a value as you never know what language a user has their keyboard set to, and you also can't guarantee the same value across platforms.
Fair enough, didn't know I could use a string. But that still doesn't explain why the 9 key above I translates to a down arrow press instead.
 
From what I've been able to gather, Shift+5 is interpreted as Left by GM, Shift+7 is interpreted as Up, and Shift+9 is interpreted as Down. I have been unable to find this functionality documented anywhere or how to stop it.
 
Top