Discuss Scratch
- Discussion Forums
- » Suggestions
- » "If List Contains"
- -Arachnid-
-
100+ posts
"If List Contains"
My Suggestion: A Block that searched an entire list for a letter.
I was recently working on a project that required a sprite to pick out certain words from a list that had letters placed in it by the user. I dedicated an entire sprite to the task, but then realized I would most likely need one sprite per word.
I was using a script that involved checking every space in the list for a letter that started off the word.
But if there was a block that searched the ENTIRE list for a single letter, I could do this with probably thirty blocks. Alas, there isn't, and now my script will forever be humongous.
Is there a workaround to this? If so, please inform me.
I was recently working on a project that required a sprite to pick out certain words from a list that had letters placed in it by the user. I dedicated an entire sprite to the task, but then realized I would most likely need one sprite per word.
I was using a script that involved checking every space in the list for a letter that started off the word.
But if there was a block that searched the ENTIRE list for a single letter, I could do this with probably thirty blocks. Alas, there isn't, and now my script will forever be humongous.
Is there a workaround to this? If so, please inform me.
- -Arachnid-
-
100+ posts
"If List Contains"
Lol. Wait, What is it you want to do?
Not this?
I looked over the only block that I actuallly needed.

- powercon5
-
1000+ posts
"If List Contains"
So that is what you need?Lol. Wait, What is it you want to do?
Not this?
I looked over the only block that I actuallly needed.
- FancyFoxy
-
500+ posts
"If List Contains"
No, I don't think that will work. It'll just see if anything in the list is the same thing as letter X of Y.Or am I missing something?
- LionHeart70
-
1000+ posts
"If List Contains"
Hmm.. well, I am still pretty new to lists, so..No, I don't think that will work. It'll just see if anything in the list is the same thing as letter X of Y.Or am I missing something?
- andyhanwu
-
76 posts
"If List Contains"
I'm a lists expert and I think that what you need is nested loops to check each letter of every list item.
https://scratch.mit.edu/projects/168851013/#editor
https://scratch.mit.edu/projects/168851013/#editor
- Auroura_Wolf
-
1000+ posts
"If List Contains"
Something like that should do it, I gotta go so I can't finish writing the script, it's missing a repeat somewhere though
Last edited by Auroura_Wolf (July 14, 2017 13:51:38)
- FancyFoxy
-
500+ posts
"If List Contains"
This script takes up time to run. The block is supposed to return a value in an instant, like theSomething like that should do it, I gotta go so I can't finish writing the script, it's missing a repeat somewhere though
block.
- Sheep_maker
-
1000+ posts
"If List Contains"
Then put it in a custom block running without screen refresh:This script takes up time to run. The block is supposed to return a value in an instant, like theSomething like that should do it, I gotta go so I can't finish writing the script, it's missing a repeat somewhere thoughblock.
- FancyFoxy
-
500+ posts
"If List Contains"
Once again, I forget Run Without Screen Refresh is a thing. Whoops.Then put it in a custom block running without screen refresh:This script takes up time to run. The block is supposed to return a value in an instant, like theSomething like that should do it, I gotta go so I can't finish writing the script, it's missing a repeat somewhere thoughblock.
- sfbs32175
-
1 post
"If List Contains"
So that is what you need?Lol. Wait, What is it you want to do?
Not this?
I looked over the only block that I actuallly needed.
I tried using that block but it actually didn't do anything.
I did:
If <___ contains answer>
say “hello”
but it doesn't do anything.
Is it because I'm using the answer block?
- StrangeMagic32
-
1000+ posts
"If List Contains"
I would suggest making a new topic in Help with scripts. That way you are more likely to get help. I tried using that block but it actually didn't do anything.
I did:
If <___ contains answer>
say “hello”
but it doesn't do anything.
Is it because I'm using the answer block?
Last edited by StrangeMagic32 (Oct. 22, 2018 13:13:19)
- dave-alt-4
-
1000+ posts
"If List Contains"
pls dont necropost (note : topic is resolved(#3))
- WescomProgramming
-
1 post
"If List Contains"
is used to check if a list contains something. Here's how to use it :
Detect if a list contains something
Detect if a list contains multiple things
To use this script, the first thing you need is to create a variable, and another list with the same contents as the targeted list.
Note : You can use anything to display the output.
Last edited by WescomProgramming (July 26, 2022 09:24:38)
- Discussion Forums
- » Suggestions
-
» "If List Contains"