Coffee Machine scenario SECTION 3 Advanced Tutorial
28
PlaySound("c:\coffee\glu.wav")
PlaySound("c:\coffee\glu.wav")
PlaySound("c:\coffee\glu.wav")
Sleep(2000)
coffee.visible(0)
PlaySound("c:\coffee\finished.wav")
displaytext = "Pick up your selection"
3. Add an Execute Script animation to coffee cup with code to call the Reset
subroutine when the cup is clicked.
3-1-7 Recipes
So we can buy, select and make a drink, but how do we handle making
different types of drinks? By creating a 'Recipe' for each choice,
predetermined amounts of ingredients can be used.
Add the points required by this step.
1, 2, 3… 1. Open the Recipe Editor.
2. Create a new recipe called "11" and add the following ingredients. Note
that for simplicity the Recipe name is made the same as the selection
code.
Now’s a good time to run the application and test the changes so far.
Point name Point type Default Value Description (optional)
aux_text Text Temporary text area for
conversions
coffee_amount Integer Amount of coffee for this
selection
milk_amount Integer Amount of milk for this
selection
selection_name Text Name of selection made
sugar_amount Integer Amount of sugar for this
selection
tea_amount Integer Amount of tea for this
selection
water_amount Integer Amount of water for this
selection
Ingredient Name Point Quantity
Ingredient 1 Name selection_name Black Coffee
Ingredient 2 Coffee coffee_amount 100
Ingredient 3 Water water_amount 100
Ingredient 4 Sugar sugar_amount 0
Ingredient 5 Milk milk_amount 0
Ingredient 6 Tea tea_amount 0