Jane Veeder AXEL Demo Tutorial Page

Parameter Score Demo - Tutorial
(c) 2003-04 Jane Veeder

Idea: You have some number of sensors that must be triggered - in any order - for some reaction to be triggered. Examples: User must click on every painting in the gallery before being able to click on the door to exit; User must click on each musical instrument to hear the orchestra play.

NOTE: Because you are setting up a fairly complex structure of sensors, links, and reactions, you should attach your sensors to dummy objects (make material go transparent at run time) allowing you to swap visible objects without having to redo all your interaction.

Method:

1. Set up your dummy objects and sensors
- Set up your dummy objects for each object that must be clicked upon, handled, or entered as a proximity zone.
- Add the appropriate type of sensor to each one.
- Edit the sensor names so you can easily distinguish them. Set the cursor types as appropriate.


2. Create a material to serve as the score variable
- Unselect any and all objects (click in empty viewport space, Edit>Unselect All, Ctrl+Shft+A), then add a new material, shaded, and give it any color. In the Project Window, open Resources > Materials.
- Select the new material, name it something like score_variable (no spaces), and select the text label of any single-value parameter such as Shininess.

3. Set up the scoring
- Select Interact>Add Reaction>SetParameter.
- Select that reaction in the interaction window and set its "Value" parameter to "1.0". Name the reaction something like SetPar_Add.
- Link all sensors on dummy objects to this reaction. Check the "Additive" checkbox so each time a sensor is clicked it adds one to the Shininess parameter value.
Multi-select all those links and set the Expiry Count to 1 so each one cannot contribute more than a value of 1 to the core.

4. Create a sensor to monitor the score variable
- Select again the text label for the Shininess parameter of our score_variable material.
- Then Interact> Add Sensor > Parameter Range. For this sensor, set the Min to .5 below the number of dummy sensors and Max to .5 above that number. This establishes the value range this sensor will monitor.

5. Create the final resulting reaction (when score has been achieved)
Create some type of reaction that clicking all the sensors will trigger.

For enabling some further interaction on a hidden sensor - the door in the original example - create a dummy object with a sensor and reaction opening the door. Then set the dummy object parameter Visible unchecked and create a SetParameter reaction making it visible (check the "Value" checkbox).

Then, link the SetParameterRange sensor to this reaction, connecting the link from the OnParamInRange link node so that when the score variable value falls within the range you've set up, this reaction will be triggered.

6. Display score variable value - for diagnostic purposes only during development
- Create a textlayer object. Select the text label for the parameter "Text".
- Select Relate>Add Custom Relation. Note that this will appear as a node under the textlayer object.
- Select the custom relation node and click on the Edit button there. The custom relation script edit window will appear.
- Open the score_variable material, select the text label for Shininess, then IN THE CUSTOM RELATION SCRIPT EDIT WINDOW, click on Insert World Selection. Your custom script becomes: TextLayer_ScoreDisplay.Text = score_variable.shininess. Press OK to finalize this.
Now, the value of the Shininess parameter will be piped to the text string that the textlayer object displays in runtime.