Conversion Between Data Types
If there are different data types within an expression, they must be converted into the same type. MADRIX Script does those conversions implicitly, but in most cases a warning will be displayed in the Compiler Messages section of the Script Editor. It is also possible to do those conversions explicitly writing the destination data type in brackets before the expression, like this:
int i = (int)GetSpeedPitch(); //if the Pitch was 6.2, i is now 6
GetSpeedPitch() returns a float value which has to be converted into int before it can be assigned to i. Be aware that the positions after the decimal point are abridged. Afterwards, the numeric value is assigned to i.
The following table shows an overview of the possible conversions:
Implicit Conversions Within Expressions
▪If one of the two operands of an expression is of the type float and the other is of the type int, the int value is converted to float and the expression results in the data type float.
▪If one of the two operands of an expression is of the type string, the other operand is converted into a string and the expression results in a string.
▪If the conversion is not possible according to the table above, the compiler prints an error and you have to correct the expression.
Here are some examples of expressions and their results:
|MADRIX Version: 5.5 | Script Version: 3.14|
|[Ctrl & +/-] = Zoom In/Out | [Ctrl & 0] = 100%|
Enable automatic translation | Activer la traduction automatique |