Binding Expressions
You can use expressions to change how values from an ARDI asset are translated into effects.
These are most often used when you need to convert a measurement from raw units (ie. meters) to a value more suitable for an effect.
The basic format is…
[ <property name/number> ]
However, there are three expression types that can help change the value.
Converting to Boolean
[ <property name/number>|value1|value2|value3 ]
This expression results in a boolean (yes/no) value. When the property (for example, 'Mode') matches any one of the given values, the boolean is 'true'. Otherwise, it's 'false'.
Using Measurement Scales
[ <property name/number>:%:<minimum>:<maximum>]
This uses the minimum and maximum scale of the measurement to rescale the value. It's most often used to convert properties from a raw value (for instance, tank level measured in meters) to a height (tank level measured in %).
Let's take a look at the following example…
Tank Level - Analogue value, 0.5 - 2.5m
If you used this expression…
[ Tank Level:%:0:100 ]
Then you would get the following values….
| Input | Output |
|---|---|
| 0.5 | 0 (0%) |
| 1 | 25 (25%) |
| 1.5 | 50 (50%) |
| 2 | 75 (75%) |
| 2.5 | 100 (100%) |
Mathematical Transform
[ <property name/number>:*:<offset>:<multiplier>]
This option allows you to add an offset and multiplier to your values.
Lets take a look at the last example, where we again want to convert a tank level in meters to a percentage.
Tank Level - Analogue value, 0.5 - 2.5m
To convert a 0.5-2.5 value to a 0-1 value, we need to first subtract 0.5, then multiply by 0.5. This gives us the following expression
[ Tank Level:*:-0.5:0.5 ]
NOTE - Where possible, please use the measurement-scale version of this function. This allows users to adjust your visual scales globally from the web interface, without needing to edit individual effect files.
Examples
| Example | Description |
|---|---|
[ Level ] | A simple copy of the property into the effect. |
[ Level|1 ] | Is '1' when the property equals one, otherwise it's 0. |
[ Level|3|5|12 ] | Is '1' when the property equals three, five or twelve, otherwise it's 0 |
[ Level:%:0:100] | Use the percentage of the property range. If the property has a range between 0 and 500, 500 results in an effect value of 100, 250 results in an effect of 50, 0 results in an effect of 0. |
[ Level:*:20:2 ] | The first option is an offset (an amount added to the base) and the second option is a multiplier. In this example, 20 is added to the amount before it is multiplied by 2, so that 0=40, 50 = 140 etc. |