Discuss Scratch

Sheep_maker
Scratcher
1000+ posts

(keys pressed?) block

scratch0maker0 wrote:

Sheep_maker wrote:

….
Good point. I didn't think of that.
However I really do like this use, so maybe this block could be changed to
(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 clicked
if <key (key) pressed?> then
end
to detect what keys are being pressed.

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

Ziggy741 wrote:

NanoRook wrote:

Ziggy741 wrote:

TheMonsterOfTheDeep wrote:

Ziggy741 wrote:

Workaround:

if <key [r v] pressed?> then
... :: grey
end
What about for this?
set [user input v] to (join (user input) (key pressed :: sensing))
I support, but I think this might be a duplicate.
Don't get it.

It's just a user input variable being set.
OK thank you, but I didn't understand what the block was being used for in that example.
When you type a letter, this block adds the letter to user input.

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

scratch0maker0 wrote:

Ok, I want a block that senses which key was pressed and returns that key.
like this:
if <(key pressed:: sensing) = [r]> then
your stuff :: grey
end
It would be helpful in touch typing projects.
For personal reasons, I support because you could do this:
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.
<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)

Pepestan_Gaming
Scratcher
100+ posts

(keys pressed?) block

Just to clear up, the any keys pressed block already exists.

<key [any v] pressed?>

EDIT: Support, by the way!

Last edited by Pepestan_Gaming (July 29, 2016 23:51:25)


alexphan
Scratcher
1000+ posts

(keys pressed?) block

Support for this:
key pressed :: sensing reporter
But 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:
<(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

theonlygusti wrote:

Ideally, Scratch would implement first class lists and then we could have this block report a list of the keys pressed, and it would look like this:

if <(keys pressed :: sensing) contains [W]?> then
end
or we could change the block to
(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?

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

(keys pressed?) block

Support, I need this block.

Alberknyis
Scratcher
1000+ posts

(keys pressed?) block

Sheep_maker wrote:

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.
DimensionPvP
Scratcher
100+ posts

(keys pressed?) block

No Support. Why bother, if there is a workaround?
Even though it's faster and less time-consuming.


Supportaa (Click to go to thread link)
————————————————————————————————————————————————————————————————–
When life gives you lemons…
you make lemonade.



Sheep_maker
Scratcher
1000+ posts

(keys pressed?) block

DimensionPvP wrote:

No Support. Why bother, if there is a workaround?
Even though it's faster and less time-consuming.
It would help to give the workaround to prove that this is in fact workaroundable and to help those who urgently need this block

- 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

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)

This exists
jromagnoli
Scratcher
1000+ posts

(keys pressed?) block

qashqai wrote:

This exists
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!
I hope I handled that well

Last edited by jromagnoli (Dec. 30, 2016 14:10:03)





ROAD TO 10,000 POSTS
████████████████████████████████████████████████████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 64%










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

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):
(keys being pressed :: sensing)

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 think it would return a string consisting of every key being pressed, 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 <(keys being pressed :: sensing) = [abcde]> :: control
say [Hello World!]
Hope I made some small contribution in what, I think, is a great idea!

post brought to you by the preview links bug and previously the uploads site bug. 看一下中文 Scratch 維基想參加?請參考這頁
Join the Scratch Wiki!
Made by Scratchers, for Scratchers, since December 6, 2008

CAT_SPRITE
Scratcher
19 posts

(keys pressed?) block

They should also add:
<key [Enter v] pressed?>
<key [Backspace v] pressed?>
<key [Custom, Eg. / v] pressed?>
and
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

CAT_SPRITE wrote:

They should also add:
<key [Enter v] pressed?>
<key [Backspace v] pressed?>
<key [Custom, Eg. / v] pressed?>
and
when [Enter v] key pressed
when [Backspace v] key pressed
when [Custom, Eg. / v] key pressed
This already exists here so it would be duplicating it, but you can go and support there as well.

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.

Powered by DjangoBB