Discuss Scratch

Cream_E_Cookie
Scratcher
1000+ posts

(keys pressed?) block

Support if:
it is a LAST key pressed (by millisecond)

















Cute_Boot-art
Scratcher
13 posts

(keys pressed?) block

Cream_E_Cookie wrote:

Support if:
it is a LAST key pressed (by millisecond)
TheMasterKing107
Scratcher
36 posts

(keys pressed?) block

Support

When gf clicked
set [Scratch v] to (current website::color sensing)
Look to the [future v] of (Scratch) ::color looks
if <(Scratch) does not [exist v]::color sensing
Say [Oh-no] for [however longer Scratch still has to exist]::color looks
TheMasterKing107
Scratcher
36 posts

(keys pressed?) block

(key pressed contains []::sensing)
(key pressed::sensing)
I support both of them.

Last edited by TheMasterKing107 (Sept. 8, 2015 13:35:17)


When gf clicked
set [Scratch v] to (current website::color sensing)
Look to the [future v] of (Scratch) ::color looks
if <(Scratch) does not [exist v]::color sensing
Say [Oh-no] for [however longer Scratch still has to exist]::color looks
scratchinghead
Scratcher
1000+ posts

(keys pressed?) block

Support.
key pressed included [] :: sensing boolean

Last edited by kaj (Today 18:04:22)
scrooge200
Scratcher
1000+ posts

(keys pressed?) block

Support.
Arthurtilly
Scratcher
1000+ 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)
There is a boolean that does that, the
<key [ v] pressed?>
block has an “any” option.

peterjhc wrote:

ALSO add Shift, Enter, Delete, Tab, Shift, and symbol support (period, comma, slash, etc.)
There are simple hacks in certain projects that let those keys be detected, but I agree it would be nice for them to be in the options.

“The world is a weird place” - Sigton | “Scratch has swallowed my life” - Sigton
“I DREW I SPOODER” - ZLGames | “My current plan is to make a plan” - ZLGames
"It's hard to watch people hanging upside down from a tree. Especially when there are no trees. - NDSDNS
“That was not grammar of correctlyness” - Arthurtilly
julianandwill
Scratcher
500+ posts

(keys pressed?) block

This would act as an automatic list, as these are automatic variables:
(x position)
(y position)
(direction)
(costume #)
(backdrop name)
(size)
(backdrop #)
(volume)
(tempo)
(distance to [ v])
(answer)
(mouse x)
(mouse y)
(loudness)
(video [ v] on [ v])
(timer)
([ v] of [ v])
(current [ v])
(days since 2000)
(username)

Last edited by julianandwill (Sept. 21, 2015 23:35:42)


Wanna help make the longest Scratch movie ever? Go here - https://scratch.mit.edu/discuss/topic/235554/

When you [have no idea v] :: events hat
Be all like [ ¯\_(ツ)_/¯] :: motion
Feel [proud v] of [yourself v] :: operators cap
Sorry if I get annoying with bumps. It's probably the kumquats messing up my brain.
14Gkurzepa
Scratcher
5 posts

(keys pressed?) block

The idea of having a
<key pressed>
would be very useful. This could allow you to make search engines without having to make a keyboard or adding an ‘if this key pressed then add this key to the list’ about a trillion times.
Support!

Maybe other keys should also be added, such as Shift, etc. etc. However this could interfere with default OS commands such as sticky keys, so it could be a problem.

Last edited by 14Gkurzepa (Jan. 30, 2017 19:03:27)


You haven't lived if you've never read The Lord of the Rings.
little_kitten
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)
No, there is an option for that in this block -
<key [any v] pressed?>

The above post was likely clear sass. 10 outta 10.
Unless it wasn't. Which happens from time to time. Sadly.
monstermash3
Scratcher
1000+ posts

(keys pressed?) block

Support, but this might be a duplicate, I think this is a pretty commonly suggested block. (Also, this topic is a bit old… No offense.)

(Swallowed by an evil kumquat who was just taking a walk in the neighborhood of evil kumquats when they saw a garage sale where they bought a plate which they used to eat but they discovered that it leaked and they went to get their money back but the sale was over so they went in the house but the door was locked so they got their key but it didn't fit so they went home to use the key on the right door which was their own door and then they decided to swallow a signature for no reason.)
monstermash3
Scratcher
1000+ posts

(keys pressed?) block

julianandwill wrote:

This would act as an automatic list, as these are automatic variables:
(x position)
(y position)
(direction)
(costume #)
(backdrop name)
(size)
(backdrop #)
(volume)
(tempo)
(distance to [ v])
(answer)
(mouse x)
(mouse y)
(loudness)
(video [ v] on [ v])
(timer)
([ v] of [ v])
(current [ v])
(days since 2000)
(username)
How about this instead: It could report like this: “qw” if keys q and w were down.

(Swallowed by an evil kumquat who was just taking a walk in the neighborhood of evil kumquats when they saw a garage sale where they bought a plate which they used to eat but they discovered that it leaked and they went to get their money back but the sale was over so they went in the house but the door was locked so they got their key but it didn't fit so they went home to use the key on the right door which was their own door and then they decided to swallow a signature for no reason.)
Justiamora
Scratcher
1 post

(keys pressed?) block

So I'm working on a project with a group of kids, each making their own level and such. One kid wants to do a dance party where the sprite calls out a number and the player presses a # key. Our problem is that we want to make it that if they press the wrong number the dance party starts over again.

We haven't been able to figure out how to do this? Does anyone have any idea.
-Io-
Scratcher
1000+ posts

(keys pressed?) block

Support. I think the keys should just return like they are normally represented by people: “Shift+Click green flag for turbo” “Ctrl+C, Ctrl+V to copy and paste respectively” “Shift+Ctrl+S to Save as”
So if the keys Ctrl and “ASDFGH” where pressed, it would return “Ctrl+A+S+D+F+G+H”.


Justiamora wrote:

So I'm working on a project with a group of kids, each making their own level and such. One kid wants to do a dance party where the sprite calls out a number and the player presses a # key. Our problem is that we want to make it that if they press the wrong number the dance party starts over again.

We haven't been able to figure out how to do this? Does anyone have any idea.
This is the suggestions forum. For this kind of things you should make a new topic in the Help with Scripts forum

JavierR100
Scratcher
500+ posts

(keys pressed?) block

Support for
(key/s pressed? :: sensing)
block

My customs Blocks on “Snap!” || search in google HN54FyF4KW27o*YWAD94qjEMLV62+]59 to find all my posts. || “Fantasy Tank Builder” Topic || Diep.io | Official Thread || Geometry Dash name account: "JavierR100". || Geometry Dash Official Topic

Actually, [B]en is my legal name!- Pen, BFB 5

Sorry, I'm gone to roblox now, so Im not able to reply anymore!

theonlygusti
Scratcher
1000+ posts

(keys pressed?) block

I support, and I think that if multiple keys are pressed it should report the most recent one.

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

joefarebrother
Scratcher
500+ posts

(keys pressed?) block

Support!

I think it should report the keys that are pressed in order of their ASCII code (but this won't be confusing because that's basically numbers in order, and letters in order, uppercase before lowercase, plus some symbols in between)

For special keys like ctrl, alt, and shift, it should list those before the other letters, separated by +.

For caps lock, there should just be a
<caps lock on?:: sensing>
block.


There is technically an easier (i.e. fewer blocks) workaround then checking each letter with a separate if, but it requires hacked blocks I think

define get keys pressed
set [index v] to [0]
set [keys v] to []
repeat (length of [keys v])
change [index v] by (1)
if <key pressed (item (index) of [keys v])?>
set [keys v] to (join (keys) (item (index) of [keys v])
end
end


And it was delicious! Play TBGs! Check out my Scheme Interpreter!
;
Techno-CAT
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?

when green flag clicked
forever

if <<key pressed? = [1 ]> and <key pressed? = [a ] >> then

end

end


See what people have created by clicking here.
scratch0maker0
Scratcher
100+ posts

(keys pressed?) block

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.

Last edited by scratch0maker0 (July 10, 2016 15:22:11)


If you cannot do great things, do small things in a great way.
Napoleon Hill
Check out my profile!
I hope I helped in some way. O:-)
Ziggy741
Scratcher
1000+ posts

(keys pressed?) block

Workaround:

if <key [r v] pressed?> then
... :: grey
end

Note that most of my posts on the forums are from years ago, probably mainly in 2016.


































(Unsolved!) How can you see all the shared projects of a deleted account? And some important context. And something else about it.
Please help me answer that question. (From May 2023)


(I know I may seem desperate, the person who owned the account whose projects I am trying to find had been doing some stuff that might need to get taken down)

Powered by DjangoBB