Asking Questions

Let's dive deeper into variables to understand how they can be used to capture and save responses from the user.

Let's talk about Variables

You've actually already usedvariables in a previous skill. Remember the utterance_remainder block? That's a variable! A variable is an object that "remembers" or stores information. In this case, it remembers anything you say beyond the key phrase.

The utterance remainder block is a block that is already part of Chatterbox, but did you know that you can make your own variables as well.


Try making your own variable by called "Answer" by clicking the 'Create variable' button in the Variables menu? You'll see two different variable blocks. The block on the left lets you SET the contents of the variable. The block on the right lets you USE the variable.

Name your variable when in the pop up.

You'll see two different variable blocks. The block on the left lets you SET the contents of the variable. The block on the right lets you USE the variable.

👂 Hey Chatterbox, Ask Me A Question!

Before we jump into making Chatterbox ask a question, let's stop and think about what actually happens when someone asks us a question.

When someone asks you your name:

1. You Listen to the question

2. They Ask a question

2. You Answer the question

3. They might respond with your name: Hi_________!


It's the same basic process to get Chatterbox to ask a question, except the block is called Get response for question. You can find this block in the Speak category because the block makes Chatterbox speak a question but save the answer to a variable.

To try this out, let's build a simple question skill. In the Get Response for question, type a question you would like the user to answer.


See below for an example:

Finally, we need to have Chatterboxrespond using the spoken answer. Use a Speak block with a double sided speech block (you can find it in the Logic category).

The green speech block is in the Logic category

What do you notice about using the Get Response block? Did you notice that after Chatterbox asks the question, it automatically starts listening without an additional button press?


✅ Review

We learned that using the Get Response with a variablelets us save an answer that we can use in a response to the user. We alsolearned how to connect answers with responses to create complete sentences.


What else can you make using these blocks?