Posted: 22nd Sep 2021 14:38
I have 4 keys mapped, left, right, up and space to control a sprite, left/right=rotate, up=move forward in the facing direction and space=file a bullet

All keys and functions work independently but I get a single fail case, rotate right while moving forward and fire, fine, switch to rotate left while still moving forward and firing and the key press fails, back to right and its fine, no else clause, all single IF's should work

in short the left key press is being ignored if the up key and space bar is down ... Bug??

+ Code Snippet
do
    if GetRawKeyState(KEY_LEFT)
		print ("KEY_LEFT")
	endif
	
    if GetRawKeyState(KEY_RIGHT)
		print ("KEY_RIGHT")
	endif
		
    if GetRawKeyState(KEY_UP)
		print ("KEY_UP")
	endif
	
    if GetRawKeyState(KEY_SPACE)
		print ("KEY_SPACE")
	endif
		
    Print( ScreenFPS() )
    Sync()
loop

#Constant KEY_LEFT 37
#Constant KEY_UP 38
#Constant KEY_RIGHT 39
#Constant KEY_SPACE 32


Edit: if I change "Space" to "Enter" it works as expected, something in the space key press is blocking other keys

+ Code Snippet
do
    if GetRawKeyState(KEY_LEFT)
		print ("KEY_LEFT")
	endif
	
    if GetRawKeyState(KEY_RIGHT)
		print ("KEY_RIGHT")
	endif
		
    if GetRawKeyState(KEY_UP)
		print ("KEY_UP")
	endif
	
    if GetRawKeyState(KEY_ENTER)
		print ("KEY_ENTER")
	endif
		
    Print( ScreenFPS() )
    Sync()
loop

#Constant KEY_LEFT 37
#Constant KEY_UP 38
#Constant KEY_RIGHT 39
#Constant KEY_ENTER 13
Posted: 22nd Sep 2021 15:18
Seems to be working fine here. Hardware issue maybe? I'd try testing with another keyboard if you can.
Posted: 22nd Sep 2021 15:33
Works fine on my Keyboard(s) as well... although this said keep in mind how a Keyboard works.

A Sequence of Keys are on a Rail, and when a Key is pressed it adds Resistance on said Rail.
Now let's say for example we have an older keyboard, where perhaps the Resistance is greatly reduced on highly used keys (like the Spacebar)
Well it's possible that while the Signal Range is "Fine" when it's on it's own... it could get drowned out by another Key in the Sequence., like say the Left Cursor.

Of course those not on the same rail would signal just fine.
I've seen very similar behaviour on quite old Hardware (like my Acorn Electron, which I've been recently renovating)
Usual to see it happen on a more modern keyboard, but it could be you're heavy handed or the design of the spacebar doesn't evenly depress it when it's hit from one of the sides.

This said, I'm just making an educated guess based on the exhibited behaviour.
Posted: 22nd Sep 2021 18:27
On my phone so cant test. Sounds a lot like key rollover: https://en.wikipedia.org/wiki/Rollover_(key) (common enough on "cheaper" keyboards for it to continue to pop up on the forums).

Google showed some small test apps, too, if u want to confirm.

Otherwise, try re-mapping ur controls away from some of the "problem" keys.
Posted: 22nd Sep 2021 18:53
It's the keyboard and mine has the same rollover.

Try this: http://www.iljitsch.com/2020/keyboardtest/
Posted: 22nd Sep 2021 19:20
Raven, another well though out and correct reply.

I plugged in another keyboard and same result but ... If I press the space on keyboard A and the arrow keys on keyboard B then it works.

This just confused me even more, so I got out a screw driver and a multi meter!

The spacebar seems to bridge all 4 lines and prevents certain keys from registering but a bit of research on keyboard wiring I think I have figured it out, most keys need access to a line in case a modifier key is pressed space being among the exemptions, the voltage varies a little from key to key but it appears under certain conditions space will lock out other keys and vice versa, I'll just change my fire button key and call it a hardware limitation.

The spacebar resistance was a little unpredictable I use some switch cleaner but it was still not exactly a reliable, it could be worn or may the variable voltage is how the space bridges all 4 lines, I don't know, its a clever system tho.

A lesson learned, when using multiple key input ALWAYS use keys accessible from modifier keys, up to 4 key at once seems to be stable but 5 and I got the same results with some keys taking precedence over others.

Another lesson learned, I have to buy some new equipment!!

EDIT: Yes, soz didn't see your posts, as you say its the old hardware, I tested it the old skool way lol
Posted: 22nd Sep 2021 19:35
I think this issue has been posted before
Posted: 24th Sep 2021 16:05
This is a very old hardware issue which is referred to as keyboard "Ghosts" and "Masks". I wrote an article explaining it a long, long time ago (2006) which should explain why it happens:

https://www.worldbydesign.com/keyboardghosts.pdf

Basically when multiple keys are pressed it can either think extra "ghost" keys are also being pressed, or that some keys are "masked" and the keyboard doesn't recognise them as being held down. It is all down the way the keyboard matrix is designed. Hopefully the above PDF should explain it.