Discuss Scratch

Tubeonscratch
Scratcher
100+ posts

How do I make functional typing?

I want to make some sort of typing game but I don't want to use this block:
ask [] and wait
I want to make it so that a variable can store the most recent character you typed. Let's say you typed F, then D, then O. The variable will store just O
Woodfur
Scratcher
100+ posts

How do I make functional typing?

Keep in mind you WON'T be able to detect capitals this way, or any way I'm aware of. It WILL work on punctuation though, no need to change anything, just add it to the long string at the top.

when [any v] key pressed
detect character in [abcdefghijklmnopqrstuvwxyz1234567890]

define detect character in (set)
set (i) to [0]
repeat (length of (set))
change [i v] by (1)
if <key (letter (i) of (set)) pressed?> then
set (last) to (letter (i) of (set))
stop [this script v]

Set the custom block to run without screen refresh. Hope this helps! And that I haven't made any mistakes, I've tested similar things before but just wrote this one on the fly

Last edited by Woodfur (April 20, 2026 08:35:01)

Tubeonscratch
Scratcher
100+ posts

How do I make functional typing?

Woodfur wrote:

Keep in mind you WON'T be able to detect capitals this way, or any way I'm aware of. It WILL work on punctuation though, no need to change anything, just add it to the long string at the top.

when [any v] key pressed
detect character in [abcdefghijklmnopqrstuvwxyz1234567890]

define detect character in (set)
set (i) to [0]
repeat (length of (set))
change [i v] by (1)
if <key (letter (i) of (set)) pressed?> then
set (last) to (letter (i) of (set))
stop [this script v]

Set the custom block to run without screen refresh. Hope this helps! And that I haven't made any mistakes, I've tested similar things before but just wrote this one on the fly
THANK YOU!!!

Powered by DjangoBB