Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Detecting Enter Key
- learncsscratch
-
Scratcher
100+ posts
Detecting Enter Key
Is there a way to detect the Enter key other than having to use “any key” which accepts everything as input?


- P444
-
Scratcher
500+ posts
Detecting Enter Key
Is there a way to detect the Enter key other than having to use “any key” which accepts everything as input?You need to modify the json file of a project. Search around for special key detection.
- monkeybike123
-
Scratcher
100+ posts
Detecting Enter Key
Unfortuently there is no way to tell if the key enter is pressed unless you do use the
ask [] and waitBlock and when you press any script below will continue
- Th3_C0d3r
-
Scratcher
100+ posts
Detecting Enter Key
There is away, but it involves using, “Hack blocks”. Cheers! 
https://scratch.mit.edu/projects/19199766/#player
-Scratch On!

https://scratch.mit.edu/projects/19199766/#player
-Scratch On!
- learncsscratch
-
Scratcher
100+ posts
Detecting Enter Key
Yeah…I went ahead and hacked a block… I hate to make a project dependent upon an unsupported feature… I am sure I will regret this later… 
Is hacking the code script JSON considered taboo? Other than potential conflict with future features, will this cause me any immediate problems?
Right now it is better than accepting any key as enter…
Thanks all…

Is hacking the code script JSON considered taboo? Other than potential conflict with future features, will this cause me any immediate problems?
Right now it is better than accepting any key as enter…
Thanks all…
Last edited by learncsscratch (Feb. 15, 2017 16:24:34)
- Th3_C0d3r
-
Scratcher
100+ posts
Detecting Enter Key
Yeah…I went ahead and hacked a block… I hate to make a project dependent upon an unsupported feature… I am sure I will regret this later…For the time being, it should work & be perfectly fine for now. The only thing that could possibly cause conflict is the Scratch 3.0 update But thats not until a long time.
Is hacking the code script JSON considered taboo? Other than potential conflict with future features, will this cause me any immediate problems?
Right now it is better than accepting any key as enter…
Thanks all…
I wouldn't think, “hacking” the JSON code is taboo. Because your not really, “hacking”. More like adding additional custom blocks to meet your needs. Many others (Myself included) have at least use these, “hack” blocks once or twice. Also, “Hack” blocks have been around for awhile now and the Scratch Team doesn't seem mad about it. So I assume it's okay.
Well thats completely up to you to decide what works best for your project. Enter key or not, the trigger block is still the same.
-Scratch On!
- kay426
-
Scratcher
41 posts
Detecting Enter Key
it is as simple as
This works.
if <key (join [enter] []) pressed?> then
end
This works.
- kay426
-
Scratcher
41 posts
Detecting Enter Key
when green flag clicked
forever
if <key (join [enter] []) pressed?> then
end
end
This works.
(#^_^#)
- codeman1044
-
Scratcher
1000+ posts
Detecting Enter Key
Please don't necropost. This topic is from 2017 and it is unlikely that anyone here still needs help with this!when green flag clicked
forever
if <key (join [enter] []) pressed?> then
end
end
This works.
(#^_^#)
- MandelbrotKing123
-
Scratcher
4 posts
Detecting Enter Key
when green flag clicked
forever
if <key (join [enter] []) pressed?> then
end
end
This works.
(#^_^#)
So actually it works if you just add a variable to key pressed? like this, and you have the variable value set to “enter”:
<key (foo) pressed?>
Where foo == “enter”
- kay426
-
Scratcher
41 posts
Detecting Enter Key
You could also use makey makey blocks to do this ; it works even if the green flag is clicked
- Discussion Forums
- » Help with Scripts
-
» Detecting Enter Key







