Discuss Scratch

MrSherlockHolmes
Scratcher
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

Centred signature.
kvackkvack
Scratcher
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:
any key pressed? :: sensing boolean
(that's supposed to be a boolean you can put into a if statement btw)
MrSherlockHolmes
Scratcher
500+ posts

(keys pressed?) block

kvackkvack wrote:

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)
Thanks! It would probably become n/a. What do you mean by ‘a block can only report one value at a time’?

Centred signature.
peterjhc
Scratcher
43 posts

(keys pressed?) block

ALSO add Shift, Enter, Delete, Tab, Shift, and symbol support (period, comma, slash, etc.)

ChocolatePi
Scratcher
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?
Thepuzzlegame
Scratcher
1000+ posts

(keys pressed?) block

ChocolatePi wrote:

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?
I'm assuming it would return the first key pressed, or maybe an array of all the keys pressed?

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) = []>

hi!
TheHockeyist
Scratcher
1000+ posts

(keys pressed?) block

peterjhc wrote:

ALSO add Shift, Enter, Delete, Tab, Shift, and symbol support (period, comma, slash, etc.)
I suggested that before…

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
Scratcher
1000+ posts

(keys pressed?) block

TheHockeyist wrote:

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
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.
when green flag clicked
crash scratch

hi!
MrSherlockHolmes
Scratcher
500+ posts

(keys pressed?) block

TheHockeyist wrote:

peterjhc wrote:

ALSO add Shift, Enter, Delete, Tab, Shift, and symbol support (period, comma, slash, etc.)
I suggested that before…

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
It's more:
(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?

Centred signature.
MrSherlockHolmes
Scratcher
500+ posts

(keys pressed?) block

Thepuzzlegame wrote:

ChocolatePi wrote:

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?
I'm assuming it would return the first key pressed, or maybe an array of all the keys pressed?

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) = []>
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…

Centred signature.
MrSherlockHolmes
Scratcher
500+ posts

(keys pressed?) block

ChocolatePi wrote:

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?
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?

Last edited by MrSherlockHolmes (Jan. 4, 2015 11:26:34)


Centred signature.
MushroomMan99
Scratcher
100+ posts

(keys pressed?) block

Support. This would make a safe-chat easier to make
set [chat message v] to (key pressed:: sensing) 

when green flag clicked
if <(language) = [English ]> then

say [Everything is Awesome!] for (2) secs
end
if <(language) = [French ]> then

say [Tout est super-genial!] for (2) secs
end
if <(language) = [Italian ]> then

say [E meraviglioso!] for (2) secs
end
if <(language) = [Spanish ]> then

say [Todo es fabuloso!] for (2) secs
end
MrSherlockHolmes
Scratcher
500+ posts

(keys pressed?) block

MushroomMan99 wrote:

Support. This would make a safe-chat easier to make
set [chat message v] to (key pressed:: sensing) 
Thanks.

Centred signature.
stickfiregames
Scratcher
1000+ posts

(keys pressed?) block

(Updated this post, changes in bold)

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)











If you can read this, my signature cubeupload has been eaten by an evil kumquat!




or you just used Inspect Element, you hacker

;
Alberknyis
Scratcher
1000+ posts

(keys pressed?) block

TheHockeyist wrote:

peterjhc wrote:

ALSO add Shift, Enter, Delete, Tab, Shift, and symbol support (period, comma, slash, etc.)
I suggested that before…

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:

ChocolatePi wrote:

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.

stop [all v] ::stack
samanyolu
Scratcher
1000+ posts

(keys pressed?) block

Support.
JimJamGo_
Scratcher
3 posts

(keys pressed?) block

Yes that would be nice

Last edited by JimJamGo_ (May 2, 2015 07:58:04)

tim556688
Scratcher
82 posts

(keys pressed?) block

Support

With Scratch, you have unlimited options for games and stuff.

Use them.

Proof? https://scratch.mit.edu/projects/35110224/
rollercoasterfan
Scratcher
1000+ posts

(keys pressed?) block

Support.














when [chromometer altimeter v] = [5th length v] and [7th length v] with a [gap v] of (17) ::events hat
forge [chromometer v] altimeter until < (speed) = (velocity)> ::control cstart
switch places with (759 v) altimeters with value of (speed) ::looks
control [altimeter 1 v] at time (10):(17):(58) ::control
end
initialize sequence (24) so [object 3 v] moves to x (156) y (231) ::control
reveal [final answer v] and stop running this script ::events cap

Powered by DjangoBB