Tutorial 7

Using the listbuilder to set variables.

Instructions
Drag and arrange states onto the canvas so that you have the following setup:


The listbuilder allows you to set the values for variables without having to write any Tcl code. In applications where you wish to repeat a series of states with different prompts and recognition configurations, the listbuilder will be invaluable.

Right click on "build_questionlist" and select "Define Lists" to get started with the listbuilder.

Previously, we used a "set" command to assign a value to a variable. In the listbulder, each variable has a list of values which it can take. The simplest case, where each list contains only one value, is equivilant to a set statement for each variable. The example above has several lists with multiple values for each list.

Right click on "new_list" and select "Rename List". This allows you to change the list name (and hence it's associated variable name). Type "question" followed by enter to change the name.


In the right-hand box, right click on the background and select "Add Entry" to add an entry to the list. Do this a total of three times, for a total of three entries which will be numbered from zero through two.


Next, you will assign values to the three entries which you have created. Left click in each entry and type the following questions:

What is the capital of the state of Washington?
How many chambers are there in the human heart?
What is the more common term for a myocardial infarction?


Next you need to add two more lists. To do this, right click in the left-hand box and select "Add List" twice to add two new lists. Rename these lists "answer" and "hints".

Left-click on "answers". This will display the entries for "answers" in the left-hand frame. Enter the following answers into this list:

Olympia
4
heart attack


Left-click on "hints" and enter the enter the following answers into this list:

It sounds like the name of the world games held every year
Less than six
A low cholesterol diet can help to avoid one of these


In the "ask_question" state, use "$question" as the prompt. This variable will contain the value of the question list on each loop through the listbuilder. Similarly, use "$hint" as the prompt in the "give_hint" state. This ensures that the hint will match the question and the answer.


In the left port of the "ask_question" state, use "$answer" for the vocabulary. This way, on each iteration the vocabulary for the state will match the question. Make the vocabulary for the right port *any.


Try running the program to get an idea of how the variables are assigned and used. Below is an image which illustrates the way that the application works: