I want to allow using the keyboard to input numbers, but also register the regular controller buttons.
It seems to work OK, except for one tiny problem: When the user presses the "8" key on the keyboard, PICO-8 also registers that as the X button on the controller.
Here's a minimally working example, run this and press the "8" key (the regular one, not on the numpad):
function _update() poke(0x5f2d,1) if (btnp(5)) print("x was pressed") end
I can only find information about "X", "V" and "M" mapping to the X button, not "8".
The following snipped will display what key and button was pressed for any key, just in case I'd missed something, but "8" being mapped to button 32 (which is of course the mask for player 1's X button) was the only surprise.
function _update() poke(0x5f2d,1) if (stat(30)) print("'"..stat(31).."' was pressed on the keyboard") c=btnp() if (c!=0) print(c.." was pressed on the controller") end
What am I missing here?
Someone on the Discord said they couldn't replicate it, so this might actually be my keyboard's fault, somehow. Not sure how though.
I use Linux, here's what xev says:
KeyPress event, serial 37, synthetic NO, window 0x9600001, root 0x2ae, subw 0x0, time 3043136515, (104,136), root:(192,288), state 0x0, keycode 17 (keysym 0x38, 8), same_screen YES, XLookupString gives 1 bytes: (38) "8" XmbLookupString gives 1 bytes: (38) "8" XFilterEvent returns: False KeyRelease event, serial 37, synthetic NO, window 0x9600001, root 0x2ae, subw 0x0, time 3043136619, (104,136), root:(192,288), state 0x0, keycode 17 (keysym 0x38, 8), same_screen YES, XLookupString gives 1 bytes: (38) "8" XFilterEvent returns: False
Looks pretty normal to me.
Edit: Tested on my Windows laptop as well. I have the same problem there, so it's probably not my keyboard or any other settings.
It happens both in the web player and in PICO-8 proper.
OK, according to @gamax92 on Discord, this is intended behavior - the "numpad -" key, together with the "8" key, are mapped to O and X.
I guess it would be nice if this was documented in the manual. But mystery solved, if this is indeed intended.
[Please log in to post a comment]