Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Detect if uppercase letter is pressed
- bungamer07
-
Scratcher
100+ posts
Detect if uppercase letter is pressed
How do I detect if an uppercase letter is pressed? I'm trying to make it so you can type but I need to be able to differentiate between uppercase and lowercase letters being typed.
- MineTurte
-
Scratcher
1000+ posts
Detect if uppercase letter is pressed
You would need to use turbowarp. It comes with a special block that can sense if shift is pressed. From there you'd want to detect if both a shift key, and the main key is pressed. Hope this helps!
if <<key [shift] pressed?> and <key [e] pressed?>> then
set [letter] to [E]
end
Last edited by MineTurte (March 14, 2024 15:59:02)
- bungamer07
-
Scratcher
100+ posts
Detect if uppercase letter is pressed
You would need to use turbowarp. It comes with a special block that can sense if shift is pressed. From there you'd want to detect if both a shift key, and the main key is pressed. Hope this helps!that works, thanksif <<key [shift] pressed?> and <key [e] pressed?>> then
set [letter] to [E]
end
- Creeper_Kid_TNT
-
Scratcher
20 posts
Detect if uppercase letter is pressed
Or for more letters you use an iteration type thing like:You would need to use turbowarp. It comes with a special block that can sense if shift is pressed. From there you'd want to detect if both a shift key, and the main key is pressed. Hope this helps!that works, thanksif <<key [shift] pressed?> and <key [e] pressed?>> then
set [letter] to [E]
end
when [any v] key pressedThen add a list for shifted letters and check if its shifting after, if so, replace it with that item in the shift list
set [LetterIndexSearch v] to [0]
repeat until <<(LetterIndexSearch) > (length of [Letters v] :: list)> or <key [(item ((LetterIndexSearch) v) of [Letters v] :: list) v] pressed?>>
change [LetterIndexSearch v] by (1)
end
if <not <(LetterIndexSearch) > (length of [Letters v] :: list)>> then
(AddLetter (item ((LetterIndexSearch) v) of [Letters v] :: list) <key [shift v] pressed?>)
end
define AddLetter(Letter)<IsShift?>
Last edited by Creeper_Kid_TNT (March 14, 2024 16:24:11)
- MineTurte
-
Scratcher
1000+ posts
Detect if uppercase letter is pressed
Or for more letters you use an iteration type thing like:You would need to use turbowarp. It comes with a special block that can sense if shift is pressed. From there you'd want to detect if both a shift key, and the main key is pressed. Hope this helps!that works, thanksif <<key [shift] pressed?> and <key [e] pressed?>> then
set [letter] to [E]
endwhen [any v] key pressedThen add a list for shifted letters and check if its shifting after, if so, replace it with that item in the shift list
set [LetterIndexSearch v] to [0]
repeat until <<(LetterIndexSearch) > (length of [Letters v] :: list)> or <key [(item ((LetterIndexSearch) v) of [Letters v] :: list) v] pressed?>>
change [LetterIndexSearch v] by (1)
end
if <not <(LetterIndexSearch) > (length of [Letters v] :: list)>> then
define AddLetter(letter (LetterIndex) of [Letters])
end
True
- Discussion Forums
- » Help with Scripts
-
» Detect if uppercase letter is pressed