# Pepper Tutorial

Dialogue boxes can be added by accessing box libraries and to click speech > creation. Select Dialog and drag the box into the root screen.

## Script

To change the dialogue box script, access Project Files and doubleclick the .top file to modify the script.

Questions can be noted by [ u: ]. Between the brackets, words or sentences can be written that the robot will recognise. The robot will answer with the words or sentences behind the brackets, and with every try, the robot will select the next answer in the written order. Example;

u: (Word1 Word2 “Sentence1”) Answer1 Answer2 “Sentence2”


## Concepts

Concepts can be written as [ concept: ] with the name between brackets. After this, the words that match the concept (that the robot will recognise if used in that way) should be written down in curly brackets. Example, where the robot gives a random greeting back when a greeting is given;

Concept: (greeting) {Hello Hi Hey “Hi there”}
u: (~greeting) ^rand ~greeting


^rand can be used, so the robot selects a “random" answer from the concept, otherwise the robot will follow the given order.

## Motions

Add a certain animation to the screen (many can be found in box libraries). Rightclick the corresponding dialogue box and edit the dialogue box (rightclick, edit box). Add a new output with a corresponding name (outputnew). Connect the output to the animation box. It might be smart to add a “wait” box too. Add the following code to access the motion;

u: (Hello) Howdy $outputnew=1  ## Animations In the script editor, to start a certain motion, write; ^start(animations/Stand/Gestures/Enthusiastic_5)  The robot will do the motion until the spoken sentence is over. To make the robot finish its animation (if the spoken sentence is shorter than the animation), write; ^wait(animations/Stand/Gestures/Enthusiastic_5)  ## Different topics When editing the dialogue box (rightclick, edit box), you can change the topic. Add a new dialogue box with a different topic and connect this box with the initial state (for example, a box that selects the language). The robot can recognise questions in any topic. When hearing a question from a certain topic, the robot will switch to that topic and answer the question. Questions can be made private. This means that the robot will ‘’only’’ recognise this question if the robot is talking about the according topic. So if a private question from another topic is asked, the robot will simply not respond. This can be done by writing ^private before a question. ## Proposals The robot can give a proposal when no specific input is given. Proposals can be labeled by using the % sign, and going to a labelled proposal can be done by using ^goto. Example; Proposal: %AskFeeling How are you feeling? u1: (_*) Ohh, so you are feeling$1 right now! $feeling=$1
u: (How am I feeling now?) I don’t know, ^goto(AskFeeling)


u: (I like _[cheese chocolate]) Yes, $1 sounds delicious$food=$1  ## SubQuestions When the answer a person gives depends on what the robot will ask/proposed next, subquestions can be used. An example is shown below. When answering “bad”, the robot will not recognise the input “good” anymore, because the robot is in the branch of the “bad”. But when in any branch, the robot will recognise any other question (that’s not a subquestion of a different branch) and switch to that if asked. u: (what’s up) Hi, how are you? u1: (good) glad! u1: (bad) sad.. Chocolate? u2: (yes) Okey! u2: (no) No problem!  ## (Temporary) knowledge robot If an answer of an input contains a stored value that is not known yet, the robot will not respond to the asked question. To fix this, ^first can be used in the following way: u:(what is my name?) ^first[“your names is$name” “I dont know ^goto(askName)”]
u1: (_*) Nice to meet you, $1!$name=$1.  The robot always prefers the first answer (Your name is$name), but if \$name isn't known, then the robot will go to the second answer, which asks the name.