Discuss Scratch
- MrSherlockHolmes
-
500+ posts
(keys pressed?) block
(key/s pressed? :: sensing)Would be useful because the workaround is very complicated, and it help with text editors, chatbots and simulations.
<key [L v] pressed?>could be exchanged with
<(key/s pressed? :: sensing)=[L]>So what do you think?
MrSherlockHolmes
- kvackkvack
-
500+ 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:
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)
- MrSherlockHolmes
-
500+ posts
(keys pressed?) block
Thanks! It would probably become n/a. What do you mean by ‘a block can only report one value at a time’? 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)
- peterjhc
-
43 posts
(keys pressed?) block
ALSO add Shift, Enter, Delete, Tab, Shift, and symbol support (period, comma, slash, etc.)
- ChocolatePi
-
1000+ posts
(keys pressed?) block
this would be incredibly useful. however, one thing I'd see wrong with it is:
if they're pressing many keys, what would it return?
if they're pressing many keys, what would it return?
- Thepuzzlegame
-
1000+ posts
(keys pressed?) block
I'm assuming it would return the first key pressed, or maybe an array of all the keys pressed? this would be incredibly useful. however, one thing I'd see wrong with it is:
if they're pressing many keys, what would it return?
Also a neat use for this block would be:
when green flag clicked
say [Press any key to continue...]
wait until <not <(keys pressed::sensing) = []>
- TheHockeyist
-
1000+ posts
(keys pressed?) block
I suggested that before… ALSO add Shift, Enter, Delete, Tab, Shift, and symbol support (period, comma, slash, etc.)
As for the original suggestion, no support. What would this be used for? Hopefully not this:
forever
if (any key pressed :: sensing) then
crash Scratch
end
Last edited by TheHockeyist (Jan. 4, 2015 01:18:39)
- Thepuzzlegame
-
1000+ posts
(keys pressed?) block
I for one think this block has many uses such as the one I mentioned below. And as for crashing Scratch the same could be down simply with. As for the original suggestion, no support. What would this be used for? Hopefully not this:forever
if (any key pressed :: sensing) then
crash Scratch
end
when green flag clicked
crash scratch
- MrSherlockHolmes
-
500+ posts
(keys pressed?) block
It's more:I suggested that before… ALSO add Shift, Enter, Delete, Tab, Shift, and symbol support (period, comma, slash, etc.)
As for the original suggestion, no support. What would this be used for? Hopefully not this:forever
if (any key pressed :: sensing) then
crash Scratch
end
(keys pressed)but I see where your coming from. It would probably say n/a if you press to many keys, but I'm not sure. How much data do you think scratch could cope with?
- MrSherlockHolmes
-
500+ posts
(keys pressed?) block
True, it would be nice to use it like that, just one question, would space be or ? Because if they press space, maybe nothing would happen, if it senses as null…I'm assuming it would return the first key pressed, or maybe an array of all the keys pressed? this would be incredibly useful. however, one thing I'd see wrong with it is:
if they're pressing many keys, what would it return?
Also a neat use for this block would be:when green flag clicked
say [Press any key to continue...]
wait until <not <(keys pressed::sensing) = []>
- MrSherlockHolmes
-
500+ posts
(keys pressed?) block
It would probably become n/a. But I'm not really sure at what point ‘too many keys’ are pressed… How much can scratch cope with? this would be incredibly useful. however, one thing I'd see wrong with it is:
if they're pressing many keys, what would it return?

Last edited by MrSherlockHolmes (Jan. 4, 2015 11:26:34)
- MushroomMan99
-
100+ posts
(keys pressed?) block
Support. This would make a safe-chat easier to make
set [chat message v] to (key pressed:: sensing)
- MrSherlockHolmes
-
500+ posts
(keys pressed?) block
Thanks. Support. This would make a safe-chat easier to makeset [chat message v] to (key pressed:: sensing)
- stickfiregames
-
1000+ posts
(keys pressed?) block
(Updated this post, changes in bold)
Support for
Not sure about
(1) If multiple keys are pressed, how would it format it? What order would they be in? How would they be separated (with a space, or without)? Support if it only returns the last key to be pressed if multiple keys are, or returns nothing if no keys are pressed.
(2) The named keys have different names in different languages or different operating systems, so someone who did not use the same language and OS as the block reported might be confused when it did not appear to detect keys. Since the block will probably be used for text entry, it might be better if it just didn't report non-text keys at all. That way you wouldn't have to filter them out from your input, and there are few enough of them that you could just use the key pressed block for that instead.
Support for
<any key pressed? :: sensing>This now exists as an option in the dropdown of the <key [] pressed?> block.
Not sure about
(keys pressed :: sensing)because of ambiguity:
(1) If multiple keys are pressed, how would it format it? What order would they be in? How would they be separated (with a space, or without)? Support if it only returns the last key to be pressed if multiple keys are, or returns nothing if no keys are pressed.
(2) The named keys have different names in different languages or different operating systems, so someone who did not use the same language and OS as the block reported might be confused when it did not appear to detect keys. Since the block will probably be used for text entry, it might be better if it just didn't report non-text keys at all. That way you wouldn't have to filter them out from your input, and there are few enough of them that you could just use the key pressed block for that instead.
Last edited by stickfiregames (Nov. 11, 2015 13:24:42)
- Alberknyis
-
1000+ posts
(keys pressed?) block
I suggested that before… ALSO add Shift, Enter, Delete, Tab, Shift, and symbol support (period, comma, slash, etc.)
As for the original suggestion, no support. What would this be used for? Hopefully not this:forever
if (any key pressed :: sensing) then
crash Scratch
end
Guess what:
when green flag clicked
crash Scratch::grey
So basically according to you even the green flag hat block can be a threat.
As for the original thing, I'd like to suggest a solution to this problem:
this would be incredibly useful. however, one thing I'd see wrong with it is:
if they're pressing many keys, what would it return?
My idea is to make use put the keys pressed in an imaginary list(or whatever it's called), and combine it with this block:
(keys pressed includes []?::sensing)Any characters typed in there will make the boolean return true when any of them are pressed.
- JimJamGo_
-
3 posts
(keys pressed?) block
Yes that would be nice
Last edited by JimJamGo_ (May 2, 2015 07:58:04)