Hello, and welcome to this fourth tutorial about score.
In this tutorial, we will study how to write interactive triggers in 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).
Hit the T button on the top:
A yellow T with an downward-pointing arrow should appear. This means that this state will be triggered interactively from now on.
The dashes signifies that « something » can happen.
Then, when clicking on the interval, in its inspector, more options appear, as showcased here :
The trigger, as mentioned before, has an expression. This expression is evaluated constantly whenever the score as reached the point where the trigger may be triggered (i.e. it has reached the beginning of the dashed part of the interval preceding the trigger).
When the execution reaches the max bound(s) of the intervals prior to the trigger, it will be automatically triggered.
When the expression is false, and the intervals prior to the trigger have no maximum bound, then the trigger will always be waiting to be triggered but
will never automatically 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.