scripting:reference:system_functions:mathsfunctions
Table of Contents
Maths Functions
sysRand
Format | sysRand ( [MAX_NUM] ) |
---|---|
Description | Returns a random number between 1 and the value specified |
Example | $var = Rand(500) |
sysSin
Format | sysSin ( ANGLE, [SCALE] ) |
---|---|
Description | Returns a sine value ; Angle is in degrees (0 to 360), Scale is an optional parameter, that scales the result from the sine function which would normally be a value from -1 to 1 |
Returns | Scaled sine value |
Parameters | Angle - 0 to 360 degrees |
Scale - |
Example:
Event( "Custom", "TreeCircle" ) { $angle = 0 while ( $angle < 360 ) { $posX = sysSin( $angle, 100 ) $posY = sysCos( $angle, 100 ) $posX += $gPlayerWorldX $posY += $gPlayerWorldY *addtree 1,$posX,$posY $angle += 36 } }
sysCos
Format | sysCos ( ANGLE, [SCALE] ) |
---|---|
Description | Returns a cosine value ; Angle is in degrees (0 to 360), Scale is an optional parameter, that scales the result from the cosine function which would normally be a value from -1 to 1 |
Returns | Scaled cosine value |
Example: See sysSin above
sysGetDist
Format | sysGetDist ( X1, Y1, X2, Y2 ) |
---|---|
Description | Calculates the distance between two points |
Returns | Distance |
Example:
Event( "AccessBuilding", "1" ) { $dist = sysGetDist( $gPlayerWorldX, $gPlayerWorldY, $gBuildingWorldX, $gBuildingWorldY ) *msg %PLAYER% You accessed the building from $dist cm away }
scripting/reference/system_functions/mathsfunctions.txt · Last modified: 2020/02/07 03:27 by mit