I had a great time at the Bett show last week, running a workshop on how to use Scratch to code an interactive talking ChatBot.
The ChatBot asks you questions, and then personalises a conversation with you, based on your responses. This is done using variables (to store information about you) and decisions (so that the ChatBot can decide what to say next).
Here’s how to code the beginnings of a ChatBot:
I had a conversation at the workshop, in which someone commented that it’s a shame the ChatBot doesn’t actually speak.
Well with ScratchX, it can! ScratchX is a place to tinker with experimental Scratch extensions that connect with external hardware (such as electronic devices and robotics) and online resources (including web data and web services).
One of these is a text to speech extension, that includes a new ‘speak’ block to speak text that’s given to it. Clicking the ‘Text to Speech’ extension on the ScratchX homepage opens up the Scratch environment with the additional block in the ‘more blocks’ section. The new ‘speak’ block can then be added to the ChatBot’s code, so that it speaks text before displaying it on the screen.
Here’s how the ChatBot works with the additional ‘speak’ blocks:
There are other extensions available, including ones to track the position of the ISS or to integrate tweets into Scratch projects!