Discuss Scratch
- Discussion Forums
- » Suggestions
- » A "last key pressed" reporter (9:3:2) Now with a Q&A!
- k7e
-
1000+ posts
A "last key pressed" reporter (9:3:2) Now with a Q&A!
Currently there are no reporter blocks that report values that are different in different languages. What if this happens:
<(last key pressed :: sensing) = [down arrow]>Then it won't work for French speakers because the block would report whatever “down arrow” is in French, not the English word “down arrow”.
- k7e
-
1000+ posts
A "last key pressed" reporter (9:3:2) Now with a Q&A!
The “username” block does not count, @griffpatch's username will still be @griffpatch for French speakers. Currently there are no reporter blocks that report values that are different in different languages. What if this happens:<(last key pressed :: sensing) = [down arrow]>Then it won't work for French speakers because the block would report whatever “down arrow” is in French, not the English word “down arrow”.
- Knightbot63
-
1000+ posts
A "last key pressed" reporter (9:3:2) Now with a Q&A!
Bumping this up.
- PaperMarioFan2022
-
1000+ posts
A "last key pressed" reporter (9:3:2) Now with a Q&A!
Bump because there was a dupe.
- jmdzti_0-0
-
1000+ posts
A "last key pressed" reporter (9:3:2) Now with a Q&A!
It would look like this ␣.Space key symbol? What would that look like? And how would one type that into a textbox? And I don't no support suggestions just for the sake of arguing or no supporting- I try to use logical reasons to determine my stance. And I'm not completely no supporting- I'm semi supporting. ~snip~
Btw this block already exists and funcions in TurboWarp
(last key pressed::#FF6680)//Custom block argument
- jmdzti_0-0
-
1000+ posts
A "last key pressed" reporter (9:3:2) Now with a Q&A!
Doesn't matter, as the javascript doesn't change languages. eg: Currently there are no reporter blocks that report values that are different in different languages. What if this happens:<(last key pressed :: sensing) = [down arrow]>Then it won't work for French speakers because the block would report whatever “down arrow” is in French, not the English word “down arrow”.
<key (join[down arrow][]) pressed?>//this will work even if it's on another language
- Scratchedbyyou
-
100+ posts
A "last key pressed" reporter (9:3:2) Now with a Q&A!
To make it report arrow keys, we would need
foreverMaybe it could be simplified, but that's what I came up with..
if <key [any v] pressed?> then
if <not <<<key [up arrow v] pressed?> or <key [down arrow v] pressed?>> or <<key [left arrow v] pressed?> or <key [right arrow v] pressed?>>>> then
set [last key pressed v] to (last key pressed::sensing)
else
if <key [up arrow v] pressed?> then
set [last key pressed v] to [up arrow]
end
if <key [down arrow v] pressed?> then
set [last key pressed v] to [down arrow]
end
if <key [left arrow v] pressed?> then
set [last key pressed v] to [left arrow]
end
if <key [right arrow v] pressed?> then
set [last key pressed v] to [right arrow]
end
end
end
end
Last edited by Scratchedbyyou (May 1, 2024 16:34:36)
- TheCreatorOfUnTV
-
1000+ posts
A "last key pressed" reporter (9:3:2) Now with a Q&A!
Here is a possible workaround that isn't ridiculously large.
define last key pressed
set [i v] to [1]
repeat (length of [keys v])
if key (item (i) of [keys v]) pressed remember
change [i v] by (1)
end
define if key (key) pressed remember
if <key (key) pressed?> then
set [last key pressed v] to (key)
end
- GamesReinvented
-
100+ posts
A "last key pressed" reporter (9:3:2) Now with a Q&A!
Yet even this workaround doesn't work perfectly, because if you have multiple keys, for example a and z, pressed at the same time (registering both) then the “last key pressed” variable would say “z” as the last key pressed (or, depending on your list order whichever key is the furthest down the list) even if you pressed down z first and held it, then pressed down a. Here is a possible workaround that isn't ridiculously large.define last key pressed
set [i v] to [1]
repeat (length of [keys v])
if key (item (i) of [keys v]) pressed remember
change [i v] by (1)
end
define if key (key) pressed remember
if <key (key) pressed?> then
set [last key pressed v] to (key)
end
Although this is a relatively specific scenario, it happens alot for things like controls.
Last edited by GamesReinvented (Oct. 12, 2024 16:27:59)
- MillionOfficial
-
500+ posts
A "last key pressed" reporter (9:3:2) Now with a Q&A!
S U P P O R T
Last edited by MillionOfficial (Oct. 12, 2024 16:52:08)
- DangerPuppy10
-
1000+ posts
A "last key pressed" reporter (9:3:2) Now with a Q&A!
oh, I found another one earlier though…dupeThough the original poster closed that one, so I have no idea.
topics should definitely be merged, although I don't know if this is the earliest one….
edit: here
ok, this is a dupe of this topic https://scratch.mit.edu/discuss/topic/78370/
but the topic above is also a dupe of this topic https://scratch.mit.edu/discuss/topic/53826/?page=1, although the topic I just linked is about the key that is CURRENTLY being pressed.
I'm so confused right now.
Last edited by DangerPuppy10 (Oct. 12, 2024 18:08:44)
- medians
-
1000+ posts
A "last key pressed" reporter (9:3:2) Now with a Q&A!
Are you okay??oh, I found another one earlier though…dupeThough the original poster closed that one, so I have no idea.
topics should definitely be merged, although I don't know if this is the earliest one….
edit: here
ok, this is a dupe of this topic https://scratch.mit.edu/discuss/topic/78370/
but the topic above is also a dupe of this topic https://scratch.mit.edu/discuss/topic/78370/, although the topic I just linked is about the key that is CURRENTLY being pressed.
I'm so confused right now.
https://scratch.mit.edu/discuss/topic/53826/?page=1
Also this too, though the topics could just merge.
- DangerPuppy10
-
1000+ posts
A "last key pressed" reporter (9:3:2) Now with a Q&A!
yeah I saw that, I just linked the. same thing twice and messed that up.Are you okay??oh, I found another one earlier though…dupeThough the original poster closed that one, so I have no idea.
topics should definitely be merged, although I don't know if this is the earliest one….
edit: here
ok, this is a dupe of this topic https://scratch.mit.edu/discuss/topic/78370/
but the topic above is also a dupe of this topic https://scratch.mit.edu/discuss/topic/78370/, although the topic I just linked is about the key that is CURRENTLY being pressed.
I'm so confused right now.
https://scratch.mit.edu/discuss/topic/53826/?page=1
Also this too, though the topics could just merge.
so we should merge this topic with the first topic I linked and then merge that with the earlier one??????
- Discussion Forums
- » Suggestions
-
» A "last key pressed" reporter (9:3:2) Now with a Q&A!