4.1. State Referencing
Start State
Let us create transitions for a virtual agent that handles time, weather, and playing music:
#5
: shows the current time (although it is correct only twice a day at the moment).#8
: informs the current weather in Sunnyville.#11
: plays the song "Raining Tacos".#14
: print the error message and references to thestart
state.
Notice that when the user input does not match any of the conditions, it prints the error message and loops back to the start
state.
Custom States
It is possible to name any transition you create as a state:
#6
: names the state astime
.#9
: names the state asweather
.#13
: names the state asplay_raining_tacos
.#17
: references to theplay_raining_tacos
state.
Exit State
State referencing can be abused to create transitions that never end (infinite loop). It is important to design an exit state so you can terminate the conversation without throwing errors:
#6,10,14,17
: loops back to thestart
state.#19-21
: creates an exit state to terminate the dialogue.
What is the main difference between an error
transition and an exit
state?
Last updated