How do i make a reporter that reports keys pressed

If i press a, its going to report a
If i press a and b, its going to report list: a, b
If i press A (shift + a) its going to report: A
and i wonder if its possible to do something like:
(unicode of a = 97), if a pressed, its going to report 97.
if both keys pressed, its going to report list: 97, 98

You can make that block like this:


However, the unicode thing isn't possible because it conflicts with other keys like shift, that are a word rather than a character.

can i get the block? its too long to me to write that down in javascript block

some characters like á, ý, gets stuck, i wonder why?

@helicoptur

please just edit your posts, don't use soooo many posts.
also, this has already been asked.

What he said.
Anyway, now to answer questions:

Of course! I'll link it here.

I don't know why that happens, but it's not a direct result of the code afaik, probably something to do with javascript in general.

And please don't @mention people or make a ton of replies to get their attention. It's really annoying.

It's inevitable without a major redesign of input routines.
If you press Alt then a Snap gets events:

  • Alt is pressed
  • "ą" is pressed
    When you release keys
  • Alt is released
  • a is released

There is no release info for "ą" (sometimes) and unfortunately not any clue. So there is no easy patch routine (as for other combination with alt, ctrl, shift). Test project.

hmm, when i press like letter "g" it returns "G" at last key code, why does it do that?

did you have capslock on?

nope i didnt

Keys on the keyboard are described as "g" not "G" isn't it?
Ok, to be serious, "keydown" events are a mix of backward compatibility, unsettled features, pure obscurity additionally messed-up by Snap!
There are many sources of information e.g. https://www.freecodecamp.org/news/javascript-keycode-list-keypress-event-key-codes/

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.