scripting:reference:system_functions
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| scripting:reference:system_functions [2015/02/23 14:19] – mit | scripting: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: | (Note also the list of [[Scripting: | ||
| - | |||
| - | ===== Maths Functions ===== | ||
| - | |||
| - | ==== sysRand ==== | ||
| - | ^ Format | sysRand ( [MAX_NUM] )| | ||
| - | ^ Description | Returns a random number between 1 and the value specified | | ||
| - | ^ Example | '' | ||
| - | |||
| - | ==== 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 | | ||
| - | // | ||
| - | < | ||
| - | { | ||
| - | $angle = 0 | ||
| - | while ( $angle < 360 ) | ||
| - | { | ||
| - | $posX = sysSin( $angle, 100 ) | ||
| - | $posY = sysCos( $angle, 100 ) | ||
| - | $posX += $gPlayerWorldX | ||
| - | $posY += $gPlayerWorldY | ||
| - | *addtree 1, | ||
| - | $angle += 36 | ||
| - | } | ||
| - | } | ||
| - | </ | ||
| - | </ | ||
| - | |||
| - | ==== 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 | | ||
| - | // | ||
| - | \\ | ||
| - | |||
| - | ==== 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 | | ||
| - | // | ||
| - | < | ||
| - | { | ||
| - | $dist = sysGetDist( $gPlayerWorldX, | ||
| - | *msg %PLAYER% You accessed the building from $dist cm away | ||
| - | } | ||
| - | </ | ||
| - | </ | ||
| ===== Player-status Functions ===== | ===== Player-status Functions ===== | ||
| Line 87: | Line 33: | ||
| ^ Parameters | **[index]** - Inventory slot number | | ^ Parameters | **[index]** - Inventory slot number | | ||
| ^ Returns | **[ItemNum]** - The item number in the specified inventory slot (or 0 if the slot is empty) | | ^ Returns | **[ItemNum]** - The item number in the specified inventory slot (or 0 if the slot is empty) | | ||
| - | ^ Notes | Players currently have 16 inventory slots. | | + | ^ Notes | Players currently have up to 64 inventory slots. | |
| // | // | ||
| < | < | ||
| { | { | ||
| $loop = 0 | $loop = 0 | ||
| - | while( $loop < 16 ) | + | while( $loop < 64 ) |
| { | { | ||
| | | ||
| Line 401: | Line 347: | ||
| { | { | ||
| $buildingName = sysGetTextEntry() | $buildingName = sysGetTextEntry() | ||
| - | $didAdd = sysAddBuildingWorld( nBuildingType, | + | $didAdd = sysAddBuilding( nBuildingType, |
| } | } | ||
| } | } | ||
| Line 614: | Line 560: | ||
| ==== sysGetRealTimeTextForDays ==== | ==== sysGetRealTimeTextForDays ==== | ||
| - | TBD // | + | ^ Format | sysGetRealTimeTextForDays ( [Number of game days] )| |
| - | // | + | ^ Description | Returns a text description of the time that will pass for the specified number of game days | |
| + | ^ Parameters | Number of game days | | ||
| + | ^ Returns | Time text | | ||
| + | //Example//: < | ||
| + | < | ||
| + | { | ||
| + | $daysSinceLastUsed = $gGameDay - $gPlayerKey[LastUsedPotionDay] | ||
| + | if ( $daysSinceLastUsed < 10 ) | ||
| + | { | ||
| + | $daysUntilCanUse = 10 - $daysSinceLastUsed | ||
| + | $timeText = sysGetRealTimeTextForDays( $daysUntilCanUse ) | ||
| + | *say You must wait $timeText until you can use the Magic Potion again | ||
| + | } | ||
| + | else | ||
| + | { | ||
| + | *effect %PLAYER% 10 | ||
| + | $gPlayerKey[LastUsedPotionDay] = $gGameDay | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | </ | ||
| ===== Battle game Functions ===== | ===== Battle game Functions ===== | ||
| Line 629: | Line 594: | ||
| ==== BattleSendChallenge ==== | ==== BattleSendChallenge ==== | ||
| + | |||
| + | ===== Maths Functions ===== | ||
| + | |||
| + | ==== sysRand ==== | ||
| + | ^ Format | sysRand ( [MAX_NUM] )| | ||
| + | ^ Description | Returns a random number between 1 and the value specified | | ||
| + | ^ Example | '' | ||
| + | |||
| + | ==== 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 | | ||
| + | // | ||
| + | < | ||
| + | { | ||
| + | $angle = 0 | ||
| + | while ( $angle < 360 ) | ||
| + | { | ||
| + | $posX = sysSin( $angle, 100 ) | ||
| + | $posY = sysCos( $angle, 100 ) | ||
| + | $posX += $gPlayerWorldX | ||
| + | $posY += $gPlayerWorldY | ||
| + | *addtree 1, | ||
| + | $angle += 36 | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | ==== 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 | | ||
| + | // | ||
| + | \\ | ||
| + | |||
| + | ==== 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 | | ||
| + | // | ||
| + | < | ||
| + | { | ||
| + | $dist = sysGetDist( $gPlayerWorldX, | ||
| + | *msg %PLAYER% You accessed the building from $dist cm away | ||
| + | } | ||
| + | </ | ||
| + | </ | ||
| ===== Misc other functions ===== | ===== Misc other functions ===== | ||
scripting/reference/system_functions.1424701192.txt.gz · Last modified: (external edit)
