Discuss Scratch
- Sheep_maker
- Scratcher
1000+ posts
(keys pressed?) block
However I really do like this use, so maybe this block could be changed toGood point. I didn't think of that. ….
(letters pressed::sensing)Which reports keys in order of when they have started to be pressed, separated by no spaces (unless the space key is pressed) and also includes the other characters on the keyboard.
For now, you might have to play around with
when gf clickedto detect what keys are being pressed.
if <key (key) pressed?> then
end
Last edited by Sheep_maker (July 20, 2016 03:53:43)
- Sheep_maker This is a kumquat-free signature. :P
This is my signature. It appears below all my posts. Discuss it on my profile, not the forums. Here's how to make your own.
.postsignature { overflow: auto; } .scratchblocks { overflow-x: auto; overflow-y: hidden; }
- 24691357
- Scratcher
100+ posts
(keys pressed?) block
When you type a letter, this block adds the letter to user input.OK thank you, but I didn't understand what the block was being used for in that example.Don't get it.What about for this? Workaround:if <key [r v] pressed?> then
... :: grey
endset [user input v] to (join (user input) (key pressed :: sensing))I support, but I think this might be a duplicate.
It's just a user input variable being set.
If it is in India, I'm Indian, including i-words.
24691357
Safe cloud chat https://scratch.mit.edu/projects/116768922/
- Yanderan
- Scratcher
100+ posts
(keys pressed?) block
For personal reasons, I support because you could do this: Ok, I want a block that senses which key was pressed and returns that key.
like this:if <(key pressed:: sensing) = [r]> thenIt would be helpful in touch typing projects.
your stuff :: grey
end
when gf clicked
forever
if <(key pressed::sensing) = [?]> then
do ya thing :3::grey
end
Last edited by Yanderan (July 21, 2016 14:08:53)
This is Zach. He protects me from the MAD KUMQUATS!!!
:)::motion
And this is Emily. She also protects me from kumquats.
:D::sound
- sokoloia20
- New to Scratch
4 posts
(keys pressed?) block
There is one unit.
Looks like that:
<key [space v] pressed?>Now added a new red block:
<all keys pressed?>This is cool!
Looks like that:
<key [all v] pressed?>
Last edited by sokoloia20 (July 29, 2016 23:36:42)
- alexphan
- Scratcher
1000+ posts
(keys pressed?) block
Support for this:
key pressed :: sensing reporterBut if more than one key was held, then maybe report it as a list?
Last edited by alexphan (July 30, 2016 00:19:05)
- Sheep_maker
- Scratcher
1000+ posts
(keys pressed?) block
This wouldn't work:
What order would these keys be listed in? How would backspace, enter, tab, and shift/ctrl/alt/etc. be reported? Would the symbols be reported as well? How would it report shift+H? What if caps lock was on? etc. etc. etc.
However first class lists would make everything easier and so
<(keys pressed::sensing)=[h]>if “h” and “k” were both being pressed, assuming that first class lists aren't coming with this block. And what format would the list be: “hk” “h k” “h, k” etc.?
What order would these keys be listed in? How would backspace, enter, tab, and shift/ctrl/alt/etc. be reported? Would the symbols be reported as well? How would it report shift+H? What if caps lock was on? etc. etc. etc.
However first class lists would make everything easier and so
first class lists and then we could have this block report a list of the keys pressed, and it would look like this:or we could change the block to Ideally, Scratch would implementif <(keys pressed :: sensing) contains [W]?> then
end
(last key pressed::sensing)
- Sheep_maker This is a kumquat-free signature. :P
This is my signature. It appears below all my posts. Discuss it on my profile, not the forums. Here's how to make your own.
.postsignature { overflow: auto; } .scratchblocks { overflow-x: auto; overflow-y: hidden; }
- liam48D
- Scratcher
1000+ posts
(keys pressed?) block
As people have said, detecting one key when two keys are pressed wouldn't work with this.
So.. just make a new block, like this, right?
Oh, wait, that already exists:
So what really could be helpful is just letting any block be put into “select”, so you could put “join” in it:
Or even just make it so that you can type in the input. You know how the play-drum block has a dropdown input that's also editable?
I think it'd be best if the dropdown input was replaced with an input like that - a dropdown input that could also be typed in (Text, of course, not just numbers.) and given blocks
So.. just make a new block, like this, right?
<key [type here] pressed? :: sensing>
Oh, wait, that already exists:
<key [select v] pressed?>
So what really could be helpful is just letting any block be put into “select”, so you could put “join” in it:
<key (join [,] []) pressed?>
Or even just make it so that you can type in the input. You know how the play-drum block has a dropdown input that's also editable?
play drum (3 v) for (0.25) beats
I think it'd be best if the dropdown input was replaced with an input like that - a dropdown input that could also be typed in (Text, of course, not just numbers.) and given blocks
Last edited by liam48D (July 30, 2016 05:12:04)
202e-202e-202e-202e-202e UNI-CODE~~~~~
- Alberknyis
- Scratcher
1000+ posts
(keys pressed?) block
or we could change the block to(last key pressed::sensing)
This actually exists in a programming language called small basic (and probably other languages I don't know about):
As for the OP, I kind of think it's best that whatever we come up with in the end only returns one key. It is possible to account for all the keys currently pressed, with some sort of special list:
(keys currently pressed :: looks) //contains all keys currently pressed (duh)
if <(length of [keys currently pressed v] :: list) > [0]> then
something::pen
end
But this would stand out like a zebra in a field of horses. Not a good idea.
Last edited by Alberknyis (July 31, 2016 04:51:06)
stop [all v] ::stack
- Jcaptain
- Scratcher
10 posts
(keys pressed?) block
Support.
Last edited by Jcaptain (July 31, 2016 04:55:17)
Hi, I made a signature since I wanted a signature.
- Sheep_maker
- Scratcher
1000+ posts
(keys pressed?) block
It would help to give the workaround to prove that this is in fact workaroundable and to help those who urgently need this block No Support. Why bother, if there is a workaround?
Even though it's faster and less time-consuming.
- Sheep_maker This is a kumquat-free signature. :P
This is my signature. It appears below all my posts. Discuss it on my profile, not the forums. Here's how to make your own.
.postsignature { overflow: auto; } .scratchblocks { overflow-x: auto; overflow-y: hidden; }
- qashqai
- Scratcher
3 posts
(keys pressed?) block
I support!
It shouldn't be called key/s pressed? though, since a block can only report one value at one time.
Also, when no keys are pressed, does it change to “none” or something like that, or will it stay as the last one?
If it's the latter, there should be a block like this too:any key pressed? :: sensing boolean(that's supposed to be a boolean you can put into a if statement btw)
This exists
- jromagnoli
- Scratcher
1000+ posts
(keys pressed?) block
Hi there! This is an old topic, so please don't post if you aren't adding anything to the discussion. Thanks for reading and Scratch on! This exists
I hope I handled that well
Last edited by jromagnoli (Dec. 30, 2016 14:10:03)
- kenny2scratch
- Scratcher
500+ posts
(keys pressed?) block
I think what's going on here is a block that returns the current key being pressed.
What the block should be named is (in my opinion):
What the block should be named is (in my opinion):
(keys being pressed :: sensing)
I think it would return a string consisting of every key being pressed, this would be incredibly useful. however, one thing I'd see wrong with it is:in alphabetical order. Then if you want to say “Hello World” when the keys a, b, c, d and e are being pressed, you simply do
if they're pressing many keys, what would it return?
if <(keys being pressed :: sensing) = [abcde]> :: controlHope I made some small contribution in what, I think, is a great idea!
say [Hello World!]
post brought to you by the preview links bug and previously the uploads site bug. 看一下中文 Scratch 維基!想參加?請參考這頁。
- CAT_SPRITE
- Scratcher
19 posts
(keys pressed?) block
They should also add:
<key [Enter v] pressed?>and
<key [Backspace v] pressed?>
<key [Custom, Eg. / v] pressed?>
when [Enter v] key pressed
when [Backspace v] key pressed
when [Custom, Eg. / v] key pressed
(Life)
- CAT_SPRITE
- Scratcher
19 posts
(keys pressed?) block
.
Last edited by CAT_SPRITE (March 1, 2017 20:15:32)
(Life)
- CAT_SPRITE
- Scratcher
19 posts
(keys pressed?) block
if <<(key pressed:: sensing) = (Enter:: sensing)>> then
broadcast [Next v]
end
Last edited by CAT_SPRITE (March 4, 2017 13:09:34)
(Life)
- duckboycool
- Scratcher
1000+ posts
(keys pressed?) block
This already exists They should also add:here so it would be duplicating it, but you can go and support there as well.<key [Enter v] pressed?>and
<key [Backspace v] pressed?>
<key [Custom, Eg. / v] pressed?>when [Enter v] key pressed
when [Backspace v] key pressed
when [Custom, Eg. / v] key pressed
Personally, I say no support since it just isn't that useful. You normally will have a couple of keys that may be pressed, not all of them.
Last edited by duckboycool (March 4, 2017 14:42:15)
I used to be active on the forums, but I have mostly moved past Scratch. I still do check my Scratch messages, so if you'd like to talk to me, just leave a comment on my profile. My main project on Scratch was Cookie Clicker, but my newest project is Snake Snake, a game based off of Snake, but with two snakes, and you can play either singleplayer or multiplayer.