This is the golden Day 3 of your building and publishing project. Here I am going show you how you can build a chatbot. I am going to use Turbowarp for code editing and project creation but you can also use scratch if you want to deploy your project to the Cana Devs studio.
Here are the steps to building a great Chatbot, I am going to name it “CanaRobot”. I am using my own project named “Quantum Chatbot” as the prototype. All the files will be given in the next embed page of Google drive, where you can review them and make your own version, so let’s get started.
Setting up
Go to your block coding editor (it should be scratch or based on it). I am using for building this, but it would recommend using scratch’s online editor so you can publish it and upload it to the Cana Studio directly without any hassle of saving and loading. Let’s start
I have saved my “Quantum Chatbot” project to my computer and loaded it in on Turbowarp:
Rename the title from “Quantum Chatbot” to “CanoRobot”, this is basic customization.
Change visual aspects
For this, you will have to know how to edit basic stuff in the scratch vector editor.
For this example, I am going to remove the main oval of the costume but you can do anything or even change it entirely.
I made it a bit smaller also btw.
Now I am going to change a bit of the background, to rebrand this project to CanaRobot.
I will change the text to “Cana Robot”
Now there we go, did some basic editing!
Coding your project
This is a bit hard because some projects contain code scattered like pieces of pasta on a plate, which makes it difficult to edit the code but you can always use the “Clean up blocks” feature or if you use or you will have a better option called “Clean up blocks +”. Make sure you are a bit careful with this step or else you can break the whole project or main parts of it.
For this example, I am going to:
Add more “CanaRobot” branding Add the new command to the list So let’s add the CanaRobot branding first by going to the “Chatbot” sprite.
I am on the Chatbot sprite, now I am going to scroll down until I stumble upon these blocks containing sensing and operators.
I am going to change the ‘Let’s start with you saying “Chatbot”’ to ‘Let’s start with you saying “CanaRobot”’
I have to also change the <(answer) contains “Chatbot”?> block to <(answer) contains “CanaRobot”?>
Nice, here it is changed:
Now I am going to add a new command that allows you find a square root or number, this is more complicated as you have use operators and if then statements.
First, I am going drag out a “if <> then { }” block from the control category.
Second, I am going also drag out “(answer)” from the sensing category and “(apple) contains (a)?” and “sqrt of ()” from the operators category. Also I am going to borrow a “ask (What’s your name?) and wait.” from the sensing category.
You will need to change “abs of ()” to “sqrt of ()” before using it from the operators category.
Third, for the finale, I am going to bring out a “say (Hello!)” block from Looks category.
Now let’s combine these blocks into this:
And the last step is to attach it to the main block codebase which is:
Note that the orange circled part was script of our square root command. Now we are going to test it out here is the diagram:
I started out by typing “CanaRobot” and then typed “Square” as the command and then it asked me the input number (which I entered 20) and then it returned 4.47, which is not the exact but an accurate portion (The answer not being exact-to-exact is not a problem or a bug made by me, it is just how scratch works and Turbowarp is a fork of scratch only)
Now, after implementing the command, I have add it on the help guide. This step is the easiest in building so far, so this wouldn’t be such a pain.
The implementation was successful and now you can check out the project file, it is given in the next subpage of these series of pages.
Now you can take a break of 10-15 minutes if you want.