This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-02-16 00:37:06

JJROCKER
Scratcher
Registered: 2010-09-06
Posts: 1000+

Keyword Help!

I am currently working on a project for school where you can talk to the computer and it can help you with history. I made one mode where it recognizes questions and that works fine but I'm working with keywords now in another mode and I'm having tons of trouble. I've tried everything I could think of.

For example, if you say hi to it, I want it to pick an answer from a list of answers which I already have created. How can I do that?

Thank you all so much and please get back to me quickly so I can continue working on it  big_smile


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://img255.imageshack.us/img255/3491/signature1y.jpg&link2=http://img577.imageshack.us/img577/5272/signature1sx.jpg&link3=http://img4.imageshack.us/img4/8514/signature1et.jpg&link4=http://i.imgur.com/POEpQyZ.png&link5=http://img163.imageshack.us/img163/4640/jjrockerfinal.jpg

Offline

 

#2 2012-02-16 00:40:04

MrMonk999
Scratcher
Registered: 2011-12-17
Posts: 500+

Re: Keyword Help!

Make a list called hi then use if answer = hi say item pick random one to length of hi of hi


http://i.imgur.com/CAMJe.png

Offline

 

#3 2012-02-16 00:42:08

JJROCKER
Scratcher
Registered: 2010-09-06
Posts: 1000+

Re: Keyword Help!

Oh boy, this was a mistake  tongue  I was so used to the help with scripts being at the top  tongue


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://img255.imageshack.us/img255/3491/signature1y.jpg&link2=http://img577.imageshack.us/img577/5272/signature1sx.jpg&link3=http://img4.imageshack.us/img4/8514/signature1et.jpg&link4=http://i.imgur.com/POEpQyZ.png&link5=http://img163.imageshack.us/img163/4640/jjrockerfinal.jpg

Offline

 

#4 2012-02-16 00:44:12

JJROCKER
Scratcher
Registered: 2010-09-06
Posts: 1000+

Re: Keyword Help!

MrMonk999 wrote:

Make a list called hi then use if answer = hi say item pick random one to length of hi of hi

I'm a little confused with the end part. Do you think you can show me using the blocks?

Thank you so much  big_smile


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://img255.imageshack.us/img255/3491/signature1y.jpg&link2=http://img577.imageshack.us/img577/5272/signature1sx.jpg&link3=http://img4.imageshack.us/img4/8514/signature1et.jpg&link4=http://i.imgur.com/POEpQyZ.png&link5=http://img163.imageshack.us/img163/4640/jjrockerfinal.jpg

Offline

 

#5 2012-02-16 00:45:46

JJROCKER
Scratcher
Registered: 2010-09-06
Posts: 1000+

Re: Keyword Help!

For some reason, it says a number, not what's on the list  hmm


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://img255.imageshack.us/img255/3491/signature1y.jpg&link2=http://img577.imageshack.us/img577/5272/signature1sx.jpg&link3=http://img4.imageshack.us/img4/8514/signature1et.jpg&link4=http://i.imgur.com/POEpQyZ.png&link5=http://img163.imageshack.us/img163/4640/jjrockerfinal.jpg

Offline

 

#6 2012-02-16 00:48:26

MrMonk999
Scratcher
Registered: 2011-12-17
Posts: 500+

Re: Keyword Help!

If<(answer)=(hi)>
Say <item<pick random<1> to <10>> of hi>


http://i.imgur.com/CAMJe.png

Offline

 

#7 2012-02-16 00:48:43

JJROCKER
Scratcher
Registered: 2010-09-06
Posts: 1000+

Re: Keyword Help!

I actually just figured it out on my own  big_smile  That way didn't work for some reason. My way worked though.

Last edited by JJROCKER (2012-02-16 00:49:09)


http://www.blocks.scratchr.org/API.php?action=random&amp;return=image&amp;link1=http://img255.imageshack.us/img255/3491/signature1y.jpg&amp;link2=http://img577.imageshack.us/img577/5272/signature1sx.jpg&amp;link3=http://img4.imageshack.us/img4/8514/signature1et.jpg&amp;link4=http://i.imgur.com/POEpQyZ.png&amp;link5=http://img163.imageshack.us/img163/4640/jjrockerfinal.jpg

Offline

 

#8 2012-02-16 03:28:12

jji7skyline
Scratcher
Registered: 2010-03-08
Posts: 1000+

Re: Keyword Help!

JJROCKER wrote:

I actually just figured it out on my own  big_smile  That way didn't work for some reason. My way worked though.

Basically, you want to add all the words from the

 (answer)
into a list as seperate items.

Then do a check of (if list contains [  ]) and then if so, reply with ()  smile

It took me a few weeks to work this script out, and it's the basic script system of my chatbot Julia  wink


I don't know why you say goodbye, I say hello!  big_smile

Offline

 

#9 2012-02-17 16:04:26

MrMonk999
Scratcher
Registered: 2011-12-17
Posts: 500+

Re: Keyword Help!

JJROCKER wrote:

I actually just figured it out on my own  big_smile  That way didn't work for some reason. My way worked though.

You have, to add all desired responses int your list


http://i.imgur.com/CAMJe.png

Offline

 

#10 2012-02-19 21:15:11

Mokat
Scratcher
Registered: 2011-12-08
Posts: 1000+

Re: Keyword Help!

 
when gf clicked
ask [What's your question?] and wait
if [questions v] contains (answer)
do this

Last edited by Mokat (2012-02-19 21:15:23)


http://www.eggcave.com/egg/977371.pnghttp://www.eggcave.com/egg/977376.pnghttp://www.eggcave.com/egg/1005291.pnghttp://www.eggcave.com/egg/996745.png

Offline

 

#11 2012-02-19 21:41:05

ImagineIt
Scratcher
Registered: 2011-02-28
Posts: 1000+

Re: Keyword Help!

MrMonk999 wrote:

If<(answer)=(hi)>
Say <item<pick random<1> to <10>> of hi>

That picks a random answer from the hi list.

Offline

 

#12 2012-02-19 21:49:46

CatPerson
Scratcher
Registered: 2011-12-17
Posts: 1000+

Re: Keyword Help!

Ask [keyword:]
If <(Answer)=(Pie)>
Broadcast [History of Pie]
end

Last edited by CatPerson (2012-02-19 21:50:01)


http://nyopoliticker.files.wordpress.com/2012/02/in_dog_we_trust_rusty.jpghttps://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcSrxH2RAmte9adghivuoOhgklIlUcZUFuCAA0wFufFq-NWyZWg5http://www.buttonsonline.com/2012/obama/BO-rallysign-104.gif

Offline

 

Board footer