Hello, and welcome to this fourth tutorial about i-score.
In this tutorial, we will study how to write interactive triggers in i-score.
It is directly following the previous tutorial which was about interactive conditions.
Triggers are a way to specify interactivity : we can say
« WHEN A happens, THEN perform B ».
Select the last State (the blue dot). The Inspector shows a « Trigger » line and an Event line.
Upon unrolling Trigger, we can perform the « Add a trigger » action.
A similar expression editor as before is shown and the score changes in the following way :
The dashes signifies that « something » can happen.
Then, when clicking on the constraint, in its inspector, more options appear, as showcased here :
The trigger, as mentioned before, has an expression. This expression is evaluated at each tick when
the temporal logic of the score is such that the trigger may be triggered.
When the expression is false, and the constraints prior to the trigger have no maximum bound, then the trigger will always be waiting to be triggered but
will never actually trigger.
The expression editor of the trigger, as saw previously with the conditions, allows the following options :
- The traditional operators « <, >, ==, <=, >= ». In this case, the trigger is run as soon as an expression becomes true. If the expression is true beforehand, it will be triggered directly at the min boundary.
- True : the trigger will always be true. This is the default case, also in operation if there is no expression. It means that it will be triggered as soon as the min boundary is reached during execution.
- False : the trigger will always be false. This is useful to have infinite loops, for instance in order to build interactive installations that should always be running.
- Pulse : the trigger will run as soon as a message is received on this address, without doing any conditional work.
Finally, during execution, one can trigger something by hand by clicking on the icon in the score view.