# Key pressed

How to detect arbitary key presses and the pressed key?

since you said it's easier in js in the JIT compiler post you linked this from, i assume you know how you would use this in other cases (like to replace a boolean) since this is essentially the same as the only way to get keypresses in js

add event listener key starts press keys key equals true

Does not work
Does not have key release event
Does not output keyCode

Fine I think ill stick to javascript after all

key isn't a number unless it's the number keys, so unless you're pressing those i don't know what you're expecting

it also doesn't look like you're doing anything with the keys list, so i'm not sure what you're expecting to happen

if you need to detect when a key is released just wait until it's released and do a broadcast or whatever code

if you want to use javascript, go ahead, but i think you really need some more patience, all languages are going to have hard problems with something you're trying to do, and i feel like it's a bit rude to the snap devs to immediately dismiss it before trying to solve a problem

fine ill stick to javascript
@18001767679 can u pls help me with my version of snip os?
i want to make it as some cmd thing

Uh?Why me?
Anyways,okay.
https://replit.com/@imcute-aaaa/snipos
I don't even need a canvas for this cmd thing right?

Maybe?Your textarea may work I think

Fine.
https://replit.com/@imcute-aaaa/snipos#script.js
Did not implement assembly cuz i didnt want to code in assembley

You know, you started out with interesting things to say, and just recently you've been super negative. Maybe you just need to get off the computer for a while?

Doesn't that work?

OH RIGHT THERE IS A BLOCK CALLED UNICODE OF YAHOO

BTW that doesn't work for the space, because KEY is a literal space (" "), but KEY PRESSED? doesn't accept that.

That doesn't work either (with any character it'll give "space"). Replacing the first KEY with KEY = " " (no quotes) does make it work.

this is pretty odd, i think it should be changed so that the space character works in the key pressed block

feature request?

If it's accepted, I can make a PR.

Yeah, of course that's what I meant. Dunno what's wrong with me lately.

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