Discuss Scratch

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

A "last key pressed" reporter (9:3:2) Now with a Q&A!

k7e wrote:

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”.
The “username” block does not count, @griffpatch's username will still be @griffpatch for French speakers.
k7e
Scratcher
1000+ posts

A "last key pressed" reporter (9:3:2) Now with a Q&A!

Bump
Knightbot63
Scratcher
1000+ posts

A "last key pressed" reporter (9:3:2) Now with a Q&A!

Bumping this up.
PaperMarioFan2022
Scratcher
1000+ posts

A "last key pressed" reporter (9:3:2) Now with a Q&A!

Bump because there was a dupe.
jmdzti_0-0
Scratcher
1000+ posts

A "last key pressed" reporter (9:3:2) Now with a Q&A!


DaSpudLord wrote:

DaSpudLord wrote:

~snip~
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.
It would look like this .

Btw this block already exists and funcions in TurboWarp
(last key pressed::#FF6680)//Custom block argument
jmdzti_0-0
Scratcher
1000+ posts

A "last key pressed" reporter (9:3:2) Now with a Q&A!

k7e wrote:

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”.
Doesn't matter, as the javascript doesn't change languages. eg:

<key (join[down arrow][]) pressed?>//this will work even if it's on another language
Scratchedbyyou
Scratcher
100+ posts

A "last key pressed" reporter (9:3:2) Now with a Q&A!

To make it report arrow keys, we would need
forever
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
Maybe it could be simplified, but that's what I came up with..

Last edited by Scratchedbyyou (May 1, 2024 16:34:36)

DangerPuppy10
Scratcher
1000+ posts

A "last key pressed" reporter (9:3:2) Now with a Q&A!

dupe

topics should definitely be merged, although I don't know if this is the earliest one….
TheCreatorOfUnTV
Scratcher
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
New Scratcher
100+ posts

A "last key pressed" reporter (9:3:2) Now with a Q&A!

TheCreatorOfUnTV wrote:

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
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.

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
Scratcher
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)

medians
Scratcher
1000+ posts

A "last key pressed" reporter (9:3:2) Now with a Q&A!

DangerPuppy10 wrote:

dupe

topics should definitely be merged, although I don't know if this is the earliest one….
Though the original poster closed that one, so I have no idea.
DangerPuppy10
Scratcher
1000+ posts

A "last key pressed" reporter (9:3:2) Now with a Q&A!

medians wrote:

DangerPuppy10 wrote:

dupe

topics should definitely be merged, although I don't know if this is the earliest one….
Though the original poster closed that one, so I have no idea.
oh, I found another one earlier though…

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

A "last key pressed" reporter (9:3:2) Now with a Q&A!

DangerPuppy10 wrote:

medians wrote:

DangerPuppy10 wrote:

dupe

topics should definitely be merged, although I don't know if this is the earliest one….
Though the original poster closed that one, so I have no idea.
oh, I found another one earlier though…

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.
Are you okay??
https://scratch.mit.edu/discuss/topic/53826/?page=1
Also this too, though the topics could just merge.
DangerPuppy10
Scratcher
1000+ posts

A "last key pressed" reporter (9:3:2) Now with a Q&A!

medians wrote:

DangerPuppy10 wrote:

medians wrote:

DangerPuppy10 wrote:

dupe

topics should definitely be merged, although I don't know if this is the earliest one….
Though the original poster closed that one, so I have no idea.
oh, I found another one earlier though…

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.
Are you okay??
https://scratch.mit.edu/discuss/topic/53826/?page=1
Also this too, though the topics could just merge.
yeah I saw that, I just linked the. same thing twice and messed that up.

so we should merge this topic with the first topic I linked and then merge that with the earlier one??????

Powered by DjangoBB