Discuss Scratch

KrisukoALT
Scratcher
10 posts

How to detect if answer is just all spaces

How do I make it so if you answer with all spaces and no letters in a question block it won't let you progress?
I want spaces to be in the answer, but not all just spaces.

Example:

ask [What is your name?] and wait

Answer: (just spaces)

say [Answer can't be all spaces!]

Last edited by KrisukoALT (Feb. 25, 2022 21:43:06)

The_Imaginarium
Scratcher
1000+ posts

How to detect if answer is just all spaces

set [index v] to [0]
repeat (length of (answer))
change [index v] by (1)
if <(letter (index) of (answer)) = [ ]> then // if the letter is a space test the next

else
stop [this script v]
end
end
say [Answer can't be all spaces!]
KrisukoALT
Scratcher
10 posts

How to detect if answer is just all spaces

The_Imaginarium wrote:

set [index v] to [0]
repeat (length of (answer))
change [index v] by (1)
if <(letter (index) of (answer)) = [ ]> then // if the letter is a space test the next

else
stop [this script v]
end
end
say [Answer can't be all spaces!]

Thank you

Powered by DjangoBB