Last modified 18 months ago
Last modified on 11/30/10 02:25:31
Casts convert one data type into another one. In Warzone 2100 casts are mostly used to convert float to int, int to float and bool to float. To perform a cast write the required data type in parenthesis before the expression or constant you want to convert.
Examples:
myFloat = (float)myInteger + 2.3 + (float)500 + 500.0; myInteger = 100 + numPlayers + (int)myFloat;
Note: Both (float)500 and 500.0 represent the same value. When converting FLOATs to INTs the fractional part is discarded (not rounded), so 500.8 becomes 500.
{{Scripting manual}} Category:Scripting manual ?
