Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
77 views
20 pages
Scratch4 - Chatbot
Uploaded by
Andro
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download
Save
Save scratch4 - Chatbot For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
0 ratings
0% found this document useful (0 votes)
77 views
20 pages
Scratch4 - Chatbot
Uploaded by
Andro
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Carousel Previous
Carousel Next
Download
Save
Save scratch4 - Chatbot For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
Download
Save scratch4 - Chatbot For Later
You are on page 1
/ 20
Search
Fullscreen
4117126, 11.05.0M Chatbot 8 Projects Chatbot Learn how to program your own talking robot! Step1 Introduction You are going to learn how to program a character that can talk to youl A character ike that is called a chat robot. or chatbot, What you make + Computer capable of running Scratch 3 Software * Scratch 3 (either online (https: //rpfio/scratchon) or offline (https: /rpfio/seratchoff)) Downloads + Find files to download here (https://rptio/p/en/chatbot-go), tipsfprojects.raspberrypl orgleniprojectsichatbotprint sr04117126, 11.05.0M © vestrousiam Chatbot Use code to join text in Scratch + Know that variables can be used to store userinput Use conditional selection to respond to user input in Scratch © dazitionatnotes for educators Youcan find the completed project here (inttps://rp! tipsfprojects.raspberrypl orgleniprojectsichatbotprint 21204117126, 11.05.0M Chatbot Step2 Your chatbot Before you start creating your chatbot, you need to decide what its personality is. Think about the following questions: + What isthe chatbot'’s narne? + Where does it live? + Isit happy? Serious? Funny? Shy? Friendly? ‘+ What does it ike and dislike? Open the Chatbot Scratch starter project. Online: open the starter project at rpfio/chatbot-on (hittps://rpfio/chatbot-on), Ifyouhave a Seratch account you can make a copy by clicking Remix. Offline: download the starter project from rpfio/p/en/chatbot-go (https://rpf.io/p/en/chatbot-go) and then open it using the offline editor. If youneed to download ang install the Scratch offline editor, you can findit at https://rptio/scratchoff (rpfio/scratchoff The starter project contains four character sprites. One of these will be your chatloot. Youcan either use the sprite that is already selected, or choose a different one by clicking the one you want and then selecting the show orhide eye icon from the Sprite menu below the stage. soe tipsfprojects.raspberrypl orgleniprojectsichatbotprint 31204117126, 11.05.0M Chatbot Step3 Atalking chatbot Now that you nave a chatbot with a personality, you're going to program it to talk to you. Glick on your chatbot spite. andaddthis code tot so that (EMENSESPSER i (SORTS Gikueyiecus "What a lovely name!" PUR eee) Era What's your name? Jene Rien EY What a lovely name! iris (2) Reo Click on your chatboot to test your code. When the chatbot ask for your name, type it into the box that. appears at the bottom of the Stage, and then click on the blue mark, or press Enter. tipsfprojects.raspberrypl orgleniprojectsichatbotprint 41204117126, 11.05.0M Chatbot Right now, your chatbot replies "What a lovely namel” every time you answer. You can make the chatbot's reply more personal, so that the reply is different every time a different name is typed in. Change the chatbot sprites code to ES “Hi withthe SERIES to the “what's your name?” question, so thatthe code looks ike this Pana cd Foe ( What's your name? Jenene Pod jon @D Prd for © seconds tipsfprojects.raspberrypl orgleniprojectsichatbotprint 51204117126, 11.05.0M Chatbot By storing the answer in 2 variable, you can use it anywhere your project. Create a new variable called (fim © 01a variabiein seraten + Click on Variables in the Code tab, then click on Make a Variable. cnewer Variables ake 2 Vane lake Lat ‘+ Type in the name of yourvariable. You can choose whether you would lke your variable to be available to all sprites, or to only this sprite, Press OK. ‘+ Once youhave created the variable, it wll be displayed on the Stage, or you can untick the variable in the Scripts tab to hide it. nipsufprojects.raspberryporgleniprojectsichatbotprint 6204117126, 11.05.0M Chatbot Now, change your chatbot sprites's code to set the I variable to SIE PCRS kel cc) ask QU eetmeueD and wait fe a OMCs Pee) (Hi Pend (2) Pee Your code should work as before: your chatbot should say hi using the name you type in. ‘est your program again. Notice thatthe answeryourtype ins stored inthe (8 variable, andi aso shown inthe topett-hand corner of the Stage. To make It cisappear from the Stage. goto tne (EISSN blocks section and dlickon the box next to fs thet itis not marke tipsfprojects.raspberrypl orgleniprojectsichatbotprint 71204117126, 11.05.0M Chatbot en Challenge: more questions Program your chatbot to ask another question. Can you store the answer to this new question in a new variable? tipsfprojects.raspberrypl orgleniprojectsichatbotprint 8204117126, 11.05.0M Chatbot Step 4 Making decisions You can program your chatbot to decide what to do based on the answersit receives. First, you'te going to make your chatbot ask a question that can be answered with “yes or “no” tipsfprojects.raspberrypl orgleniprojectsichatbotprint 91204117126, 11.05.0M Chatbot Change your chatbot's code. Your chatbot should ask the question “Are you OK name’ using the (IB varable, Then it should reply “That's great to hear” [fl he answeritrecelvesis "yes. but say nothing if the answeris “ac: Eas) What's your name? Jenene name * to answer join QB rare tor E seconds join CTD name and wait Ea That's great to hear! iow (2) Peo To test your new code properly, you should test it twice: once with the answer “yes: and once with the answer "no" ‘At the moment, your chatbot doesn't say anything to the answer “no” nipsufprojects.raspberryporgleniprojectsichatbotprint 101204117126, 11.05.0M Chatbot Change your chatbot's code so that it replies “Oh no!” if it receives “no” as the answerto “Are you OK name’. block wth an SERUETTERIEPSE block and include code so the chatbot can SEE Replace the (WET) Pana cd Ee What's your name? JeneIveIl Ca eee Oe Dp Gi ox) n( carn ECU Are you OK JGECMMEUCR Tens OE PM on no RO 2 eee tipsufprojects.raspberrypi orgleniprojects/chatbotprint 11204117126, 11.05.0M Chatbot ‘Test your code. You should get 2 different response when you answer “no” and when you answer “yes” your chatbot should reply with “That's great to hearl” when you answer “yes” (which is not case- sensitive}, and reply with “Oh nol" when youanswer anything else, ‘You can put any code inside an [ERUET ENE block, not just code to make your chatbot speak! IF you click yourchatbot's Costumes tab, you'll see that there is more than one costume. tipsfprojects.raspberrypl orgleniprojectsichatbotprint 127204117126, 11.05.0M Chatbot Change your chatbot's code so that the chatbot switches costumes when you type in your answer. Change the code inside he SETENRIPSER 1 ock to SERENE tipsfprojects.raspberrypl orgleniprojectsichatbotprint 131204117126, 11.05.0M Chatbot PCRS ce ask QUE etcueD and wait fe OC a (Hi ) od (2) Pen join CRED name ) and wait answer) = QB then See AC Mm id M7) ( That's great to hear! iy (2) OE Seg es aCMmL say CD or (2) Ree ‘Test and save your code. You should see your chatboot's face change depending on your answer. Have you noticed that, after your chatbot's costume has changed, it stays like that and doesnt change back to ‘what it was at the beginning? ‘You can try this out: run your code and answer “no” so that your chatbot’s face changes to an unhappy look. Then run your code again and notice that your chatbot does not change back to looking happy before it asks your name. tipsufprojects.raspberrypi orgleniprojects/chatbotprint4117126, 11.05.0M Chatbot Tom this problem, addte the chthot's cove to SIEERSNRESIIN atthe stot EME Ses Ra Ae CR a Remo EC) Tene tipsufprojects.raspberrypi orgleniprojects/chatbotprint 15:204117126, 11.05.0M Chatbot Ce Challenge: more decisions Program your chatbot to ask anather question that can be answered with “yes” or “no: Can you make your chatbot respond differently depending on which answerit receives? nipsufprojects.raspberryporgleniprojectsichatbotprint 161204117126, 11.05.0M Chatbot Step5 Changing location ‘You can also program your chatbot to change its location! Can you program your chattaot to ask “Do you want to go to the moon’, and then change the backdrop when the answeris "yes"? Ineed a hint This is what your code should look like: EE a ( Do you want to go to the moon? JEMrArle Tee Pio Aen eM Now you need to make sure that your chatbot starts in the right location when you click on it to talk to it. ‘Add this block to the top of your chatbot code: RMS Ce cc) Reece a ein Test your program, and answer "yes" when the chatbot asks if you want to go to the moon. You should see that the chatbot’s location changes. nipsufprojects.raspberryporgleniprojectsichatbotprint 171204117126, 11.05.0M Chatbot ‘Youn also add the folowing code inside the new Ej blockto make the chatbot jump up and down four times if you answer “yes': answer) = QZ then Reo amd Bey: ) change yoy @D wait EBD seconds Creag (-10) | tipsufprojects.raspberrypi orgleniprojects/chatbotprint 18120sii, 1105 904 Chabot & chationget Challenge: finish your chatbot Use what you've learned to finish creating your interactive chatbot. Here are some ideas: ‘Once you've finished your chatbot, get your friends to have a conversation with it! Do they like your character? Can they spot any problems? tipsfprojects.raspberrypl orgleniprojectsichatbotprint 191204117126, 11.05.0M Chatbot Step6 What next? Try the Paint box (https://projects.raspberrypi.org/en/projects/paint-box?utm_ source=pathway&utm_ med ium=whatnextéutm_campaign=projects) project, where youwill create your oun painting prograrl Youwill click on the green fiag to start, and you'll use the mouse to move the pencil and hold down the left mouse button to draw. Clicking on a colour will change pencil colours, and clicking on the eraserwill change to the eraser! aan 0n 4X Published by Raspberry Pi Foundation (https:/www.raspberrypi.org) under a Creative Commons license (https://creativecommons.org/licenses/by-sa/4.0/). View project & license on GitHub (https://github.com/RaspberryPiLearning/chatbot) tipsfprojects.raspberrypl orgleniprojectsichatbotprint 2020
You might also like
Chatbot
PDF
No ratings yet
Chatbot
21 pages
Chatbot-1 4
PDF
No ratings yet
Chatbot-1 4
12 pages
Project 4 Chatbots
PDF
No ratings yet
Project 4 Chatbots
21 pages
Disruptive Technology
PDF
No ratings yet
Disruptive Technology
22 pages
Girls Who Code at Home: Can I Help You? Chatbot in Python
PDF
No ratings yet
Girls Who Code at Home: Can I Help You? Chatbot in Python
18 pages
Worksheet Chatbots
PDF
No ratings yet
Worksheet Chatbots
12 pages
Introducing Python: Writing A Python Program
PDF
No ratings yet
Introducing Python: Writing A Python Program
2 pages
Chatbots Presentation
PDF
No ratings yet
Chatbots Presentation
10 pages
Coding Instructions
PDF
No ratings yet
Coding Instructions
2 pages
ChatGPT - MyLearning On Coding For ChatBot
PDF
No ratings yet
ChatGPT - MyLearning On Coding For ChatBot
5 pages
Lovely Professional University
PDF
No ratings yet
Lovely Professional University
8 pages
Presentation About Introduction To AI
PDF
No ratings yet
Presentation About Introduction To AI
22 pages
Python MicroP
PDF
No ratings yet
Python MicroP
3 pages
Out Put Code
PDF
No ratings yet
Out Put Code
1 page
Chatbot Code
PDF
No ratings yet
Chatbot Code
9 pages
Artificial Intelligence Project: Chatterbot
PDF
No ratings yet
Artificial Intelligence Project: Chatterbot
8 pages
International Journal of Computer Sciences and Engineering: A Tool of Conversation: Chatbot
PDF
No ratings yet
International Journal of Computer Sciences and Engineering: A Tool of Conversation: Chatbot
4 pages
AI Phase 4
PDF
No ratings yet
AI Phase 4
9 pages
(Web Page) Python Chatbot
PDF
No ratings yet
(Web Page) Python Chatbot
1 page
Implementation Chatbot Whatsapp Using Python Programming For Broadcast and Reply
PDF
No ratings yet
Implementation Chatbot Whatsapp Using Python Programming For Broadcast and Reply
4 pages
Design and Implementation of A Chatbot in Python: International Journal For Multidisciplinary Research
PDF
No ratings yet
Design and Implementation of A Chatbot in Python: International Journal For Multidisciplinary Research
12 pages
ANKUSH
PDF
No ratings yet
ANKUSH
20 pages
Inserchatgpt Video Script
PDF
No ratings yet
Inserchatgpt Video Script
4 pages
Chatbot Project Guide Kartik
PDF
No ratings yet
Chatbot Project Guide Kartik
2 pages
Chatbot
PDF
No ratings yet
Chatbot
2 pages
AI Chatbot Practical File
PDF
No ratings yet
AI Chatbot Practical File
2 pages
Basic Chatbot
PDF
No ratings yet
Basic Chatbot
3 pages
Project
PDF
No ratings yet
Project
4 pages
AI - Phase 5
PDF
No ratings yet
AI - Phase 5
47 pages
Building A ChatBot
PDF
100% (1)
Building A ChatBot
3 pages
ChatBot Research Paper 2
PDF
No ratings yet
ChatBot Research Paper 2
5 pages
Chatbot
PDF
No ratings yet
Chatbot
5 pages
Chatbot
PDF
No ratings yet
Chatbot
2 pages
NLP Report Merged
PDF
No ratings yet
NLP Report Merged
16 pages
Chatbots: in This Project You Will Make A Chatbot That Can Answer Questions About A Topic of Your Choice
PDF
No ratings yet
Chatbots: in This Project You Will Make A Chatbot That Can Answer Questions About A Topic of Your Choice
12 pages
Building A Chatbot A Practical Guide With Examples and Python Code 20241023050239jrve
PDF
No ratings yet
Building A Chatbot A Practical Guide With Examples and Python Code 20241023050239jrve
14 pages
Chatbots: in This Project You Will Make A Chatbot That Can Answer Questions About A Topic of Your Choice
PDF
No ratings yet
Chatbots: in This Project You Will Make A Chatbot That Can Answer Questions About A Topic of Your Choice
12 pages
Mini Chat Bot
PDF
No ratings yet
Mini Chat Bot
22 pages
Research Paper of Chatbot
PDF
No ratings yet
Research Paper of Chatbot
5 pages
Programming Challenges of Chatbot Current and Future Prospective
PDF
No ratings yet
Programming Challenges of Chatbot Current and Future Prospective
4 pages
Project
PDF
No ratings yet
Project
3 pages
ChatScript Tutorial
PDF
No ratings yet
ChatScript Tutorial
18 pages
Base Paper
PDF
No ratings yet
Base Paper
3 pages
AI Phae 2 Project
PDF
No ratings yet
AI Phae 2 Project
8 pages
Lab 15
PDF
No ratings yet
Lab 15
2 pages
Python Chatbot Project
PDF
No ratings yet
Python Chatbot Project
6 pages
Computer Python Voice Chatbot
PDF
No ratings yet
Computer Python Voice Chatbot
25 pages
Create Your Own ChatGPT Chatbot in 10 Minutes
PDF
No ratings yet
Create Your Own ChatGPT Chatbot in 10 Minutes
4 pages
Untitled 1
PDF
No ratings yet
Untitled 1
15 pages
Research Paper Chatbot
PDF
No ratings yet
Research Paper Chatbot
5 pages
Group Project
PDF
No ratings yet
Group Project
12 pages
Chatbot PPT - SOUMYA
PDF
No ratings yet
Chatbot PPT - SOUMYA
18 pages
Chatterbot
PDF
No ratings yet
Chatterbot
12 pages
The Complete Beginner's Guide To Coding With ChatGPT
PDF
No ratings yet
The Complete Beginner's Guide To Coding With ChatGPT
8 pages
Python Chat Bot Project
PDF
100% (1)
Python Chat Bot Project
6 pages
Final Project Work.
PDF
No ratings yet
Final Project Work.
3 pages
Preview Mission SC Final - 3
PDF
No ratings yet
Preview Mission SC Final - 3
6 pages
UWB Tracking System For Patient
PDF
No ratings yet
UWB Tracking System For Patient
107 pages
UWB Arduino Pro Mini
PDF
No ratings yet
UWB Arduino Pro Mini
1 page
Microbit Workshop
PDF
No ratings yet
Microbit Workshop
41 pages
Scratch5 - Paintbox
PDF
No ratings yet
Scratch5 - Paintbox
27 pages
Scratch 1
PDF
No ratings yet
Scratch 1
15 pages
Scratch3 - Ghostbusters
PDF
No ratings yet
Scratch3 - Ghostbusters
19 pages
Scratch3 0tello-EN
PDF
No ratings yet
Scratch3 0tello-EN
9 pages