Discuss Scratch
- Discussion Forums
- » Bugs and Glitches
- » 784 contains letters
- mecodetwo
-
Scratcher
100+ posts
784 contains letters
in my project https://scratch.mit.edu/projects/575925419/ I have a
<(784) contains (item (letter check :: variables) of [letters v] :: list) :: operators>where ‘letters’ is a list of a-z and A-Z, but it is returning as ‘true’
- BarelySmooth
-
Scratcher
1000+ posts
784 contains letters
Are you trying to check if the answer contains letters?
Then, have you tried setting the variable “lettercheck” to zero before going through the loop? Otherwise, the variable will never become zero and will go on to values higher than 52 (which the list doesn't have). When I opened the project, the value of lettercheck was 93. Since there weren't 93 items in the list of lettters, you might have seen bugs.
Hope this helped
Then, have you tried setting the variable “lettercheck” to zero before going through the loop? Otherwise, the variable will never become zero and will go on to values higher than 52 (which the list doesn't have). When I opened the project, the value of lettercheck was 93. Since there weren't 93 items in the list of lettters, you might have seen bugs.
set [lettercheck v] to [0] //This is done to prevent the value from going more than 52 if we run it multiple times
repeat (52)
change [lettercheck v] by (1)
...
end
Hope this helped

Last edited by BarelySmooth (Sept. 28, 2021 03:45:15)
- mecodetwo
-
Scratcher
100+ posts
784 contains letters
Are you trying to check if the answer contains letters?I am unsure if i set lettercheck to 0, but thank you so much!!!!
Then, have you tried setting the variable “lettercheck” to zero before going through the loop? Otherwise, the variable will never become zero and will go on to values higher than 52 (which the list doesn't have). When I opened the project, the value of lettercheck was 93. Since there weren't 93 items in the list of lettters, you might have seen bugs.set [lettercheck v] to [0] //This is done to prevent the value from going more than 52 if we run it multiple times
repeat (52)
change [lettercheck v] by (1)
...
end
Hope this helped
- mecodetwo
-
Scratcher
100+ posts
784 contains letters
I just looked, and what I had is,Are you trying to check if the answer contains letters?I am unsure if i set lettercheck to 0, but thank you so much!!!!
Then, have you tried setting the variable “lettercheck” to zero before going through the loop? Otherwise, the variable will never become zero and will go on to values higher than 52 (which the list doesn't have). When I opened the project, the value of lettercheck was 93. Since there weren't 93 items in the list of lettters, you might have seen bugs.set [lettercheck v] to [0] //This is done to prevent the value from going more than 52 if we run it multiple times
repeat (52)
change [lettercheck v] by (1)
...
end
Hope this helped
when this sprite clicked
set [lettercheck v] to [0]
ask [What's your password?] and wait
...
Last edited by mecodetwo (Sept. 28, 2021 22:11:25)
- D-ScratchNinja
-
Scratcher
1000+ posts
784 contains letters
It might be comparing it to a list item that doesn't exist (such as item 0). In that case, it would be checking if “784” contains “” (a nothing), which is… technically true, because if “” contains a nothing, then “784” contains a nothing.
- mecodetwo
-
Scratcher
100+ posts
784 contains letters
But it (hopefully) can't be, because in my code it says,
repeat (52)
change [lettercheck v] by (1)
...
end
- BarelySmooth
-
Scratcher
1000+ posts
784 contains letters
I just looked, and what I had is,Ohhhh, Sorry I wan't clear earlierwhen this sprite clicked
set [lettercheck v] to [0]
ask [What's your password?] and wait
...
You have to set the variable lettercheck to zero every time you iterate over a list. 
(this screenshot is from the savebutton sprite)
Last edited by BarelySmooth (Sept. 29, 2021 08:34:21)
- mecodetwo
-
Scratcher
100+ posts
784 contains letters
soo, should i put,I just looked, and what I had is,Ohhhh, Sorry I wan't clear earlierwhen this sprite clicked
set [lettercheck v] to [0]
ask [What's your password?] and wait
...You have to set the variable lettercheck to zero every time you iterate over a list.
(this screenshot is from the savebutton sprite)
ask [whats your password] and wait? (i cant see screenshot)
set [letercheck v] to [0]
...
Last edited by mecodetwo (Sept. 29, 2021 14:43:49)
- mecodetwo
-
Scratcher
100+ posts
784 contains letters
never mind, im stupid, it checks for letters twice, i havesoo, should i put,I just looked, and what I had is,Ohhhh, Sorry I wan't clear earlierwhen this sprite clicked
set [lettercheck v] to [0]
ask [What's your password?] and wait
...You have to set the variable lettercheck to zero every time you iterate over a list.
(this screenshot is from the savebutton sprite)ask [whats your password] and wait? (i cant see screenshot)
set [letercheck v] to [0]
...
if <...> thenbut i should have
if <(784)contains(item (lettercheck :: variables) of [leters v] :: list) :: operators> then
end
else
...
end
if <(784)contains(item (lettercheck :: variables) of [leters v] :: list) :: operators> then
end
if <...> then
if <(784)contains(item (lettercheck :: variables) of [leters v] :: list) :: operators> then
end
else
...
end
set [lettercheck v] to [0]
if <(784)contains(item (lettercheck :: variables) of [leters v] :: list) :: operators> then
end
Last edited by mecodetwo (Sept. 29, 2021 14:44:20)
- BarelySmooth
-
Scratcher
1000+ posts
784 contains letters
never mind, im stupid, it checks for letters twice, i haveThat's right! I hope it works for you nowif <...> thenbut i should have
if <(784)contains(item (lettercheck :: variables) of [leters v] :: list) :: operators> then
end
else
...
end
if <(784)contains(item (lettercheck :: variables) of [leters v] :: list) :: operators> then
endif <...> then
if <(784)contains(item (lettercheck :: variables) of [leters v] :: list) :: operators> then
end
else
...
end
set [lettercheck v] to [0]
if <(784)contains(item (lettercheck :: variables) of [leters v] :: list) :: operators> then
end

Also, this was the screenshot I posted earlier (I reuploaded it on scratch in case you were unable to access cubeupload images):

Last edited by BarelySmooth (Sept. 29, 2021 14:51:22)
- mecodetwo
-
Scratcher
100+ posts
784 contains letters
@BarelySmooth thank you so much!!!!! it works now.
when I'm not dumb any more and @BarelySmooth 's help makes sense :: events :: hat
reply [thank you!!] :: looks
be happy [and finish thing ] :: custom
define be happy (and finish thing)
repeat until <thing finished :: control>
watch tutorial for 2 seconds :: control
build the exact same thing in scratch :: control
end
- Discussion Forums
- » Bugs and Glitches
-
» 784 contains letters