Discuss Scratch

AarcaWhale
Scratcher
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
Scratcher
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
AarcaWhale
Scratcher
100+ posts

Matching answers to responses with lists...

GreenIeaf wrote:

Try this code ^^


ex. AlsAnswers is Al's likst and Answers is anything the scratchers put on it
That could work, but because I want there to be a long list of answers, it would clutter up the script.

Last edited by AarcaWhale (April 29, 2016 22:46:08)

GreenIeaf
Scratcher
100+ posts

Matching answers to responses with lists...

How about this one -
whenclickedforeverifAlslistcontainsanswerthensayanswer
AarcaWhale
Scratcher
100+ posts

Matching answers to responses with lists...

GreenIeaf wrote:

How about this one -
whenclickedforeverifAlslistcontainsanswerthensayanswer
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.
footsocktoe
Scratcher
1000+ posts

Matching answers to responses with lists...

Just change it to that then…

ifanswers listcontainsanswer v thensayanswer is in the list

Last edited by footsocktoe (April 30, 2016 05:50:39)

AarcaWhale
Scratcher
100+ posts

Matching answers to responses with lists...

footsocktoe wrote:

Just change it to that then…

ifanswers listcontainsanswer v thensayanswer is in the list
Like I said before, that would work, but for a long list of things to say, it would be a super long script.
GreenIeaf
Scratcher
100+ posts

Matching answers to responses with lists...

AarcaWhale wrote:

footsocktoe wrote:

Just change it to that then…

ifanswers listcontainsanswer v thensayanswer is in the list
Like I said before, that would work, but for a long list of things to say, it would be a super long script.
Not if you substitute this block
answer
into where footsocktoe has answer v
AarcaWhale
Scratcher
100+ posts

Matching answers to responses with lists...

GreenIeaf wrote:

AarcaWhale wrote:

footsocktoe wrote:

Just change it to that then…

ifanswers listcontainsanswer v thensayanswer is in the list
Like I said before, that would work, but for a long list of things to say, it would be a super long script.
Not if you substitute this block
answer
into where footsocktoe has answer v
Still, if there are 20 answers to match, I would still have to duplicate that block 20 times.
footsocktoe
Scratcher
1000+ posts

Matching answers to responses with lists...

AarcaWhale wrote:

GreenIeaf wrote:

AarcaWhale wrote:

footsocktoe wrote:

Just change it to that then…

ifanswers listcontainsanswer v thensayanswer is in the list
Like I said before, that would work, but for a long list of things to say, it would be a super long script.
Not if you substitute this block
answer
into where footsocktoe has answer v
Still, if there are 20 answers to match, I would still have to duplicate that block 20 times.


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
Scratcher
1000+ posts

Matching answers to responses with lists...

AarcaWhale wrote:

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?
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.
asksay somethingandwaitiflist1containsanswerthensetcountto0 repeatuntilitemcountoflist1=answerchangecountby1sayitemcountoflist2for2secselsesayI won't answer thatfor2secs says if the answer isnt in the list.

Last edited by awesome-llama (April 30, 2016 23:49:53)

AarcaWhale
Scratcher
100+ posts

Matching answers to responses with lists...

awesome-llama wrote:

AarcaWhale wrote:

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?
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.
asksay somethingandwaitiflist1containsanswerthensetcountto0 repeatuntilitemcountoflist1=answerchangecountby1sayitemcountoflist2for2secselsesayI won't answer thatfor2secs says if the answer isnt in the list.
That works, thanks! I'll give you credit in the project.

Powered by DjangoBB