 Hello everyone, welcome back to our channel. I hope you all are safe and sound. You must have used a chatbot at least once in your lifetime to ask a question on website or maybe just to have some fun. Today, we will make one of our own. We will first enter few questions and their answer and then when the chatbot runs, it will recognize your speech and convert it into text using Pictoblock's speech recognition extension and then answer your questions accordingly. Hello, I am Abhi, your friend. What is your name? Jennifer. Welcome Jennifer. What's on your mind Jennifer? Same as I was yesterday. What's on your mind Jennifer? Pre-requisites are a laptop or a computer with the latest version of Pictoblock's downloaded, a good internet connection and a camera. You can download the all new Pictoblocks from the link given in the description box below. Let's begin by adding the artificial intelligence and the text to speech extension. Open Pictoblocks. Click on board and select evide. You need to keep two things in mind while working with this extension. First, that your computer is connected to the internet. Second, you need to login into Pictoblock's account to use it. Click on the add extension button. Choose artificial intelligence extension. Next, let's add the text to speech extension. This extension lets you convert the audio file into the text message. Click on the add extension button again and scroll down till you find the text to speech extension. Let's begin by adding Abhi, the sprite which will be the character of our chatbot. Click on choose a sprite button. From the library, choose Abhi. Delete to be sprite by clicking on the delete button. Now let's add a good backdrop. Click on the add backdrop button and choose boardwalk from the library. You can use any backdrop of your choice. Select Abhi sprite. As we want to execute the program every time the green flag is clicked. Place the when flag clicked add block into the scripting area from the events palette. Now to get familiar with our chatbot, we will introduce Abhi to our user and ask for the name of a user to add a personalized touch to it. Thus, get a speak block from the text to speech block palette. This block converts any text written in the white space to audio form to be played on our PC or laptop speaker. Right, hello, I am Abhi your friend to introduce Abhi to your user. Again, add a speak block and ask for the user's name. Right, what is your name into the space given? This block will not store the user's name for us. Thus for storing user's name, we need to add one more block. Get recognized speech for 5 seconds in English block from the artificial intelligence palette. This block records audio and sends it to the web to decode and convert the speech into the text form. Its result, that is the user's name in our case, is stored into the speech recognition result block. Now to use the name in further communication, we will store it in a variable. Go to the variables tab. Click on make a new variable and make a string type variable named name to store the name of the user. Get a set variables block from the variables palette and choose name from the drop down. Add speech recognition result block into the space given. Now to make our chatbot welcome user, get a speak block. Put a join block inside it from the operator's palette. Write welcome into the first space of the join block and add the variable name in the second space of the join block. To continue the chat with our chatbot, we will add a forever block from the controls palette below the speak block. Now we will first prompt the user to ask a question. To do so, get a speak block and add a join block in it. We will always add a join block to make Abby say the user's name. Write what's on your mind into the first space and the name variable into the second space. Now to again recognize the user's questions, we will add the recognize speech for 10 seconds in English block to record whatever the user is speaking. Chatbot normally answers the predefined questions fed in it. Thus we will be adding a few questions which if matched chatbot can reply with the respective answers. Now get an if else block from the controls palette to check if recognized speech matches the questions. Inside the if arm, we will add an equal to operator block to check the results. Now into the first space of the equal to block, place the speech recognition results block and type in the question that is who am I in the second place. We will want our chatbot to reply as ur and the name of the user. Thus get a speak block from the text to speech palette into the if portion and add a join block inside it from the operator's palette. Add the text ur in the first space of the join block and add the variable name into the second space. Here I'll be adding a few simple questions you can add the questions and answers according to your choice. Similarly, we will be adding other questions too. Duplicate the if else arm and place it below the else arm. We will edit out the content with appropriate questions and their answers. You can add in as many questions as you want. Apart from playing around with simple questions and answers, you can even add some special features to your chatbot such as celebrate birthday, crack jokes, make it play a song and much more. We will be making one such custom event for birthday. Duplicate the if else block as we did previously and change the question portion with the statement, it is my birthday. Now when the speech matches, we will change the backdrop to match the theme. Thus add the party backdrop from the add backdrop option. Paste the change backdrop to block from the looks palette and choose party from the drop down. Now to wish the user get a speak block and add a join block inside it. Write happy birthday into the first space and drag and drop the name reporter block into the second space. Now to play a birthday song, go to the sounds tab and click on choose the sound button. Add the birthday sound. Come back to the script. From the sounds block palette, add place sound until done block below the speak block and choose birthday from the drop down. Now let's add the default case. If the recognized result does not match with any predefined questions then we will make Abby say sorry I do not understand it yet. Add a speak block into the last else portion of the question and write sorry I do not understand it yet. Now to make chatbot look more realistic, we will be adding one small script. This script will make the character that is Abby to move its face in hands to make it look like she is talking. First drag and drop the wind flag clicked hub block and add a forever block below it. Now from the looks palette, get a next costume block. Now to make costume switch visible, place a weight block from the controls palette and add wait time of 0.5 seconds. With this your script is ready. Click on the flag button to start chatting with the chatbot. You can notice the recognition time by looking at the vertical line below your video. Welcome Jennifer, what's on your mind Jennifer? Who created you? Someone at Stemphilia, what's on your mind Jennifer? It is my birthday. Happy birthday Jennifer. Share with us your interactions with your chatbot in our victim blocks community on Facebook. Also if you like this video, subscribe to Stemphilia and follow us on Facebook, Instagram and Twitter. Bye bye, stay safe.