Discuss Scratch
- wimpygirl6
- Scratcher
61 posts
"Key Pressed" Sensor Reporter Block
WHOA!!!!!!Yes it does, also, I think it would be a better idea to use this than make a new block :3Try this ^ Try some hacksdefine keyPressesInList_allRequired
set [i v] to (1)
repeat (length of [presses v])
if <not<key (item (i) of [presses v]) pressed?>>
set [yes v] to (0) // idk if key pressed accepts a reporter. Try it! Otherwise edit the json
stop [this script v] // if not ALL keys in the list are pressed, return 0
end
change [i v] by (1)
end
set [yes v] to (1) // all keys in list pressed, return 1define keyPressesInList_oneRequiredThe stop […] blocks are in there to prevent unnecessary looping, which will slow your project down. Make sure to use custom blocks like above because then stop this script will only stop the custom block. Also make sure to make the custom blocks run without screen refresh to speed up the looping.
set [i v] to (1)
repeat (length of [presses v])
if <key (item (i) of [presses v]) pressed?>
set [yes v] to (1)
stop [this script v] // if at least ONE of the keys is pressed, return 1
end
change [i v] by (1)
end
set [yes v] to (0) // no keys in the list are pressed, return 0
It works…
Um, that's basically what I said don't do that, its called spam FYI
- ScratchDiogoh
- Scratcher
1000+ posts
"Key Pressed" Sensor Reporter Block
Hello!
when green flag clickedMake all the keys
forever
if <not <key [any v] pressed?>> then
delete (1 v) of [list v]
end
if <key [space v] pressed?> then
replace item (1 v) of [list v] with [space]
end
end
+1700 Bad Posts
- Eli3210
- Scratcher
21 posts
"Key Pressed" Sensor Reporter Block
I had the same idea and found a simple way to do so.
Use this script:
Sorry that Scratch didn't put the script together right.
(P.S: the “Any” variable has a value of “any”)
Use this script:
when green flag clickedEnjoy!
forever
if <key [ (item (Any)) of Key List pressed?> then
-your script goes here
end
end
Sorry that Scratch didn't put the script together right.
(P.S: the “Any” variable has a value of “any”)
Last edited by Eli3210 (Aug. 23, 2019 22:25:55)
Hello! My name is Eli3210! I am a Scratcher who is willing to help debug a script or create an element! I am sometimes on Scratch.
Feel free to comment on my profile and request help!
Here is a random cat fact:
(COMING SOON)
- Nambaseking01
- Scratcher
1000+ posts
"Key Pressed" Sensor Reporter Block
I don't understand. Doesn't this block already exist?
I have a feeling I am missing something. Could someone please explain?
<key [c v] pressed?>
I have a feeling I am missing something. Could someone please explain?
Last edited by Nambaseking01 (Aug. 24, 2019 11:17:15)
Hey there! My name is Nammy. I'm a male Forum Helper and Scratch Wiki Editor.
Profile | Test Account | Talk with me here! | Griffpatch is quitting Scratch?!
Profile | Test Account | Talk with me here! | Griffpatch is quitting Scratch?!
- 46009361
- Scratcher
1000+ posts
"Key Pressed" Sensor Reporter Block
Yes, this block exists, but the suggestion is about asking which keys are pressed, not if a key is pressed. Like this: I don't understand. Doesn't this block already exist?<key [c v] pressed?>
I have a feeling I am missing something. Could someone please explain?
(which keys pressed? :: sensing)
Anyway, I created a workaround for this block recently (which I commented on @CombaticonsCombine but then got deleted less than an hour after). The link to the project is:
https://scratch.mit.edu/projects/328947478/
Please check it out as it only has 2 views at the time of writing! There is even a discussion forum for this project at https://scratch.mit.edu/discuss/topic/369833/!
Edit: Be sure to give credit when you backpack my script! It's part of Scratch's Community Guidelines.
Last edited by 46009361 (Sept. 19, 2019 18:12:41)
Inspired by coder2045—which, in turn, got inspired by Mr_PenguinAlex.
What's wrong with these blocks? There are zero mistakes because no round has started yet. Beware that some of the mistakes don't relate to the Scratch blocks below.
// No round has started yet.Be the first to comment all of the mistakes on my profile correctly and you'll get a love! You can't comment any mistakes right now because there are none!
- PlayerXS
- Scratcher
80 posts
"Key Pressed" Sensor Reporter Block
Sensing :: sensing hat
(Key Pressed :: sensing reporter)Yeah I had that idea too.
Last edited by kaj (Tomorrow 00:00:00)
- Nambaseking01
- Scratcher
1000+ posts
"Key Pressed" Sensor Reporter Block
I think this would be useful because a lot of people want it and the workaround is not the simplest for New Scratchers.
But I think Proli's system could give you a better understanding of how to recreate this in a simple manner.
But I think Proli's system could give you a better understanding of how to recreate this in a simple manner.
Hey there! My name is Nammy. I'm a male Forum Helper and Scratch Wiki Editor.
Profile | Test Account | Talk with me here! | Griffpatch is quitting Scratch?!
Profile | Test Account | Talk with me here! | Griffpatch is quitting Scratch?!
- sathvikrias
- Scratcher
500+ posts
"Key Pressed" Sensor Reporter Block
here is a workaround, which doesn't involve doing letter-for-letter:
define find key pressed
forever
if <key [any v] pressed?> then
set [keys v] to (keys you want to detect::undefined)
set [incroment v] to [1]
repeat (length of (keys)::operators)
if <key (letter (incroment) of (keys)) pressed?> then
set [key pressed v] to (letter (incroment) of (keys))
end
change [incroment v] by (1)
end
if <key (join [enter] []) pressed?> then
set [key pressed v] to [enter]
end
if <key [space v] pressed?> then
set [key pressed v] to [space]
end
say (key pressed)
else
say [no key is pressed]
end
end
Last edited by sathvikrias (Oct. 23, 2020 22:30:13)
Moving from Scratch? Don't learn C or Java, try Snap!
- Futurebot5
- Scratcher
1000+ posts
"Key Pressed" Sensor Reporter Block
That workaround is to long for how useful the suggestion is. here is a workaround, which doesn't involve doing letter-for-letter:define find key pressed
forever
if <key [any v] pressed?> then
set [keys v] to (keys you want to detect::undefined)
set [incroment v] to [1]
repeat (length of (keys)::operators)
if <key (letter (incroment) of (keys)) pressed?> then
set [key pressed v] to (letter (incroment) of (keys))
end
change [incroment v] by (1)
end
if <key (join [enter] []) pressed?> then
set [key pressed v] to [enter]
end
if <key [space v] pressed?> then
set [key pressed v] to [space]
end
say (key pressed)
else
say [no key is pressed]
end
end
So…hello, ou bonjour, o hola, o ciao, oder hallo.
- bluedragon8633
- Scratcher
1000+ posts
"Key Pressed" Sensor Reporter Block
Support, this also goes for touching sprites. If I have 10 different enemy sprites, it's easier to write
if <[enemy list] contains <touching [sprite] ?> ?> thenNow, if you touch any enemy on the list, it broadcasts hurt, rather than doing this:
broadcast [hurt]
end
<<<touching [enemy1] ?>> or <<<touching [enemy2] ?>> or <<<touching [enemy3] ?>> or <<<touching [enemy4] ?>> or <<<touching [enemy5] ?>> or <touching [enemy6] ?>>>>>>
Game with No Sprites: https://scratch.mit.edu/projects/710922832/
Riddle School 5- Tile Puzzle 1: https://scratch.mit.edu/projects/625744508/
RIP Adobe Flash Player
Yokan is coming.
- sathvikrias
- Scratcher
500+ posts
"Key Pressed" Sensor Reporter Block
I know, but at least it's less tedious That workaround is to long for how useful the suggestion is.
Moving from Scratch? Don't learn C or Java, try Snap!
- ssvbxx2
- Scratcher
100+ posts
"Key Pressed" Sensor Reporter Block
Support. I made a document writing program, but since there's no reporter reporting which key is pressed, it's over 400 blocks. It would be useful for projects like that.
I'm ssvbxx2. I make a variety of original projects: games, animations, etc.
(Tile Scrolling Project | Square Root Calculator | Scratchy & Friends)
Last edited by kaj (Next year 00:00:00)
- hai4a5
- Scratcher
49 posts
"Key Pressed" Sensor Reporter Block
There is a workaround Hi,https://scratch.mit.edu/projects/621656775/
I had an idea, what about a Sensor Reporter block that contained the key that was currently being pressed? If this existed, then you could have a list with all the keys that perform a specific function in it and make:if <[Task 1 Keys v] contains [(key pressed)]> thenInstead of having:
...
endif <<<<<key [... v] pressed?> or <key [... v] pressed?>> or <key [... v] pressed?>> or <key [... v] pressed?>> or <key [... v] pressed?>> thenAnd needing to repeat and change that every time you changed your mind.
...
end
Anybody else think that this is a good idea?
From Mad__Moss
However, its too limited and can cause a lot of lag, so support
- hai4a5
- Scratcher
49 posts
"Key Pressed" Sensor Reporter Block
try mine @sathvikrias that doesn't work, I see no reason it shouldn't thoughhttps://scratch.mit.edu/projects/621656775/ (see inside)
- mcgoomba
- Scratcher
1000+ posts
"Key Pressed" Sensor Reporter Block
<keys [space v] @delInput @addInput are pressed? :: sensing>//2.0is that what the block's gonna looks like?
<keys (space v) @delInput @addInput are pressed? :: sensing>//3.0
]▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒[————————————————————————————
]▒░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▒[
]▒░█░░░█░░█░░██░░█░░░█░░█░░░█░███░░░██░░▒[
]▒░██░██░█░░█░░░█░█░█░█░██░██░█░░█░█░░█░▒[
]▒░█░█░█░█░░█░█░█░█░█░█░█░█░█░███░░████░▒[
]▒░█░░░█░░█░░██░░█░░░█░░█░░░█░█░░█░█░░█░▒[
]▒░█░░░█░░█░░██░░█░░░█░░█░░░█░███░░█░░█░▒[
]▒░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▒[
]▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒[
(69 :: variables)————————————————————————————
//THE 69 COIN
please{————————————————————————————
follow [me v] :: motion
} :: control
that would make me [happy v] :: looks
————————————————————————————
=(^•ᆺ•^)=
my chinese cat
————————————————————————————
WOW, 1000+ posts!
————————————————————————————
when [anyone v] checks out (1) out of of [all of the v] scratch projects I have made :: hat events————————————————————————————
be [happy v] :: looks
forever {
if <mouse down?> then
escape loop :: control
end
when @stopSign clicked :: events hat
escape loop :: control
} @loopArrow :: control
ask (how :: sensing) and wait
- Steve0Greatness
- Scratcher
1000+ posts
"Key Pressed" Sensor Reporter Block
they're talking about<keys [space v] @delInput @addInput are pressed? :: sensing>//2.0is that what the block's gonna looks like?
<keys (space v) @delInput @addInput are pressed? :: sensing>//3.0
(key pressed :: sensing) //returns the last pressed key
like if I press
abcdqweryit would return “y.”
Last edited by Steve0Greatness (April 27, 2022 20:57:41)
/hj is the worst tone indicator. It's confusing and ambiguous. I hate it. The point of tone indicators is to indicate tone, or the way that a piece of text should be read, but what does “half joking” mean? Do you just wake up in the morning and think “wow, I really have something I want to talk about seriously but also kinda not, IDK you decide.” It's useless. I hate it. It just provokes a deep rooted anger within me whenever I see it. People just comment /hj as if it makes any sense. It doesn't. Oh wow, it's a tone indicator that's has a relative meaning, how useful, I'll use it in every comment I post. NO. STOP IT. You're a tone indicator, you have only one job, and yet you sit there doing nothing apart angering me.
/srs
^^^ (there's more below)
This one is useful because it tells you that this signature is fully 100% serious. (/srs) Who would've thought that tone indicators needed to tell you something about the piece of text they're attached to? /s
I'm serious, I'm not even going to put multiple (/hj)s a the end of my signature as to mock the previous paragraph for not getting the point of something(like previous version of my signature). /srs
- jjnxdjidshusdhusdyu
- Scratcher
8 posts
"Key Pressed" Sensor Reporter Block
no block spamOk, thanks for the info.Yes it does, also, I think it would be a better idea to use this than make a new block :3Try this ^ Try some hacksdefine keyPressesInList_allRequired
set [i v] to (1)
repeat (length of [presses v])
if <not<key (item (i) of [presses v]) pressed?>>
set [yes v] to (0) // idk if key pressed accepts a reporter. Try it! Otherwise edit the json
stop [this script v] // if not ALL keys in the list are pressed, return 0
end
change [i v] by (1)
end
set [yes v] to (1) // all keys in list pressed, return 1define keyPressesInList_oneRequiredThe stop […] blocks are in there to prevent unnecessary looping, which will slow your project down. Make sure to use custom blocks like above because then stop this script will only stop the custom block. Also make sure to make the custom blocks run without screen refresh to speed up the looping.
set [i v] to (1)
repeat (length of [presses v])
if <key (item (i) of [presses v]) pressed?>
set [yes v] to (1)
stop [this script v] // if at least ONE of the keys is pressed, return 1
end
change [i v] by (1)
end
set [yes v] to (0) // no keys in the list are pressed, return 0
It works…
Um, that's basically what I said don't do that, its called spam FYImaybe this: Really? Anyone have more ideas on how the block would work?if <keys pressed> then //there would be a check box list of keys that could be pressed.
...
end
Or you could have a list with the keys you want to be pressed:if <(item (all v) of [Key List v]) = [(key pressed)]> then //If ALL of the items in Key List are pressed then:That way you could change the keys that need to be pressed more easily.
...
end
- GameFactory42
- Scratcher
2 posts
"Key Pressed" Sensor Reporter Block
I support the idea of a “key pressed” or “active key” reporter block that returns a character (or some kind of null type if no key is down at the moment).
Last edited by GameFactory42 (June 20, 2022 00:39:28)
- gdfsgdfsgdfg
- Scratcher
1000+ posts
"Key Pressed" Sensor Reporter Block
bump cuz theres a dupe
1000th post also use -forbidden- or highlight and ctrl (optional on some browsers) + shift + down arrow for more of my siggy
We have the craps ®
I gotta go touch sum grass
If it causes issues make it optional - gdfsgdfsgdfg
Do some research before replying to my posts - gdfsgdfsgdfg
curse you 60 sec rule
glory to Gdfsg Land
gdfsgdfsgdfg returns
Ocular(don’t look at my old posts plz)
PostPercent
kumquats? nah
my siggy is built with titani- *gets eaten*
Gdfsg Radio Station:
https://scratch.mit.edu/projects/1000736602
Are you sleeping you tall cat (project):
https://scratch.mit.edu/projects/1002042247/
The only suggestions I fully support are:
https://scratch.mit.edu/projects/924995948/
Don’t force me to get proof
get it yourself
my favorite topic is this (due to comedic purposes):
https://scratch.mit.edu/discuss/topic/709979/
my favorite post is this (it’s deleted but I got it from ocular):
https://ocular.jeffalo.net/post/7517300
Grand borrowing cars IV intro and loading (template):
https://scratch.mit.edu/projects/972295666/
Guess the game by its mission name:
https://scratch.mit.edu/discuss/topic/750145/
GBC (GTA) topic:
https://scratch.mit.edu/discuss/topic/751981/
BF (Battlefield) topic:
https://scratch.mit.edu/discuss/topic/753243/
still don’t have the popularity lol (atleast I reached 100 followers)
Skill issue
reject
Embrace :)