User Tools

Site Tools


scripting:reference:system_functions

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
scripting:reference:system_functions [2015/02/23 15:43] – [sysGetInventoryItemIndex] mitscripting:reference:system_functions [2025/05/28 16:35] (current) – external edit 127.0.0.1
Line 4: Line 4:
  
 (Note also the list of [[Scripting:Reference:Special System Control Functions|special system control functions]] which includes special cases like the 'Sleep' function etc) (Note also the list of [[Scripting:Reference:Special System Control Functions|special system control functions]] which includes special cases like the 'Sleep' function etc)
- 
-===== 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| 
-^ Parameters | Angle - 0 to 360 degrees | 
-^  | Scale - Scale applied to the result from the sine function (which normally returns a value from -1 to 1 | 
-^ Returns | Scaled sine value | 
-//Example//: <note> 
-<code>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         
-    } 
-} 
-</code> 
-</note> 
- 
-==== sysCos ==== 
-^ Format | sysCos ( [ANGLE], [SCALE] )| 
-^ Description | Returns a cosine value| 
-^ Parameters | Angle - 0 to 360 degrees | 
-^  | Scale - Scale applied to the result from the cosine function (which normally returns 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| 
-^ Parameters | Point 1 X,Y | 
-^  | Point 2 X,Y | 
-^ Returns | Distance | 
-//Example//: <note> 
-<code>Event( "AccessBuilding", "1" ) 
-{ 
-    $dist = sysGetDist( $gPlayerWorldX, $gPlayerWorldY, $gBuildingWorldX, $gBuildingWorldY ) 
-    *msg %PLAYER% You accessed the building from $dist cm away 
-} 
-</code> 
-</note> 
  
 ===== Player-status Functions ===== ===== Player-status Functions =====
Line 648: Line 594:
 ==== BattleSendChallenge ==== ==== BattleSendChallenge ====
  
 +
 +===== 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|
 +^ Parameters | Angle - 0 to 360 degrees |
 +^  | Scale - Scale applied to the result from the sine function (which normally returns a value from -1 to 1 |
 +^ Returns | Scaled sine value |
 +//Example//: <note>
 +<code>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        
 +    }
 +}
 +</code>
 +</note>
 +
 +==== sysCos ====
 +^ Format | sysCos ( [ANGLE], [SCALE] )|
 +^ Description | Returns a cosine value|
 +^ Parameters | Angle - 0 to 360 degrees |
 +^  | Scale - Scale applied to the result from the cosine function (which normally returns 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|
 +^ Parameters | Point 1 X,Y |
 +^  | Point 2 X,Y |
 +^ Returns | Distance |
 +//Example//: <note>
 +<code>Event( "AccessBuilding", "1" )
 +{
 +    $dist = sysGetDist( $gPlayerWorldX, $gPlayerWorldY, $gBuildingWorldX, $gBuildingWorldY )
 +    *msg %PLAYER% You accessed the building from $dist cm away
 +}
 +</code>
 +</note>
  
 ===== Misc other functions ===== ===== Misc other functions =====
scripting/reference/system_functions.1424706212.txt.gz · Last modified: (external edit)