Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Matching answers to responses with lists...
- AarcaWhale
-
100+ posts
Matching answers to responses with lists...
I'm making an AI, and I created two separate lists, one with answers the Scratcher can give, and another one with answers the AI will give. Is there any way to match them, so if item 2 of the “answers” list is “hello,” the AI can match it with the item 2 on the its own answer list, and say “hello” back?
- GreenIeaf
-
100+ posts
Matching answers to responses with lists...
Try this code ^^

ex. AlsAnswers is Al's likst and Answers is anything the scratchers put on it

ex. AlsAnswers is Al's likst and Answers is anything the scratchers put on it

- AarcaWhale
-
100+ posts
Matching answers to responses with lists...
That could work, but because I want there to be a long list of answers, it would clutter up the script. Try this code ^^
ex. AlsAnswers is Al's likst and Answers is anything the scratchers put on it
Last edited by AarcaWhale (April 29, 2016 22:46:08)
- AarcaWhale
-
100+ posts
Matching answers to responses with lists...
Well, it's not the AI's answer that I'm looking for, the script needs to see if the answers list contains the Scratcher's answer. How about this one -
- footsocktoe
-
1000+ posts
Matching answers to responses with lists...
Just change it to that then…
Last edited by footsocktoe (April 30, 2016 05:50:39)
- AarcaWhale
-
100+ posts
Matching answers to responses with lists...
Like I said before, that would work, but for a long list of things to say, it would be a super long script. Just change it to that then…
- GreenIeaf
-
100+ posts
Matching answers to responses with lists...
Not if you substitute this blockLike I said before, that would work, but for a long list of things to say, it would be a super long script. Just change it to that then…
into where footsocktoe has answer v

- AarcaWhale
-
100+ posts
Matching answers to responses with lists...
Still, if there are 20 answers to match, I would still have to duplicate that block 20 times.Not if you substitute this blockLike I said before, that would work, but for a long list of things to say, it would be a super long script. Just change it to that then…into where footsocktoe has answer v
- footsocktoe
-
1000+ posts
Matching answers to responses with lists...
Still, if there are 20 answers to match, I would still have to duplicate that block 20 times.Not if you substitute this blockLike I said before, that would work, but for a long list of things to say, it would be a super long script. Just change it to that then…into where footsocktoe has answer v
Not if answer is a variable. Don't confuse the blue answer with the orange answer. The blue answer is a sensor block. The orange data block would be a variable you create yourself, maybe call it “current answer” to avoid confusion.
You ask a question.
You set “current answer” to blue answer
You search the list for current answer.
Simple.
- awesome-llama
-
1000+ posts
Matching answers to responses with lists...
This script asks, you answer, and the script checks if the answer is in list1 (your responses) then works out where it is in the list then says the item in the list2. I'm making an AI, and I created two separate lists, one with answers the Scratcher can give, and another one with answers the AI will give. Is there any way to match them, so if item 2 of the “answers” list is “hello,” the AI can match it with the item 2 on the its own answer list, and say “hello” back?
Last edited by awesome-llama (April 30, 2016 23:49:53)
- AarcaWhale
-
100+ posts
Matching answers to responses with lists...
That works, thanks! I'll give you credit in the project.This script asks, you answer, and the script checks if the answer is in list1 (your responses) then works out where it is in the list then says the item in the list2. I'm making an AI, and I created two separate lists, one with answers the Scratcher can give, and another one with answers the AI will give. Is there any way to match them, so if item 2 of the “answers” list is “hello,” the AI can match it with the item 2 on the its own answer list, and say “hello” back?

- Discussion Forums
- » Help with Scripts
-
» Matching answers to responses with lists...