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 13:45] – doc for sysGetNearestPlayer mit | scripting:reference:system_functions [2025/05/28 16:35] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 33: | 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 96: | Line 96: | ||
| ==== sysIsPlayerIDOnline ==== | ==== sysIsPlayerIDOnline ==== | ||
| - | Example : '' | + | ^ Format | sysIsPlayerIDOnline( |
| - | Returns 1 if the specified player | + | ^ Description | Used to determine |
| + | ^ Parameters | Player ID | | ||
| + | ^ Returns | **1** if the player is connected, **0** if not | | ||
| + | ^ Example | '' | ||
| ==== sysIsInSpawnZone ==== | ==== sysIsInSpawnZone ==== | ||
| - | Example : '' | + | ^ Format | sysIsInSpawnZone( |
| - | Returns 1 if the current player is in the specified spawn zone, 0 if not \\ | + | ^ Description | Used to determine |
| + | ^ Parameters | SpawnZone Type/ID | | ||
| + | ^ Returns | **1** if the player is in the region, **0** if not | | ||
| + | ^ Example | '' | ||
| ==== sysIsInTown ==== | ==== sysIsInTown ==== | ||
| Line 130: | Line 136: | ||
| ==== sysPlayerSkillLevel ==== | ==== sysPlayerSkillLevel ==== | ||
| - | Example : '' | + | Example : '' |
| - | Returns the current player' | + | Returns the current player' |
| ==== sysPlayerIsLearningSkill ==== | ==== sysPlayerIsLearningSkill ==== | ||
| - | TBD // | + | Example : '' |
| - | // | + | Returns **1** if the player is currently learning the specified skill, **0** if not. \\ |
| ===== Player Building Ownership Functions ===== | ===== Player Building Ownership Functions ===== | ||
| Line 208: | Line 214: | ||
| ==== sysAmountInStocks ==== | ==== sysAmountInStocks ==== | ||
| - | Example | + | ^ Format | sysAmountInStocks( [Item_Name or Num] )| |
| - | Returns the amount of the item named currently in the player' | + | ^ Description | Returns the amount of the item currently in the building' |
| + | ^ Parameters | Item Name or number | | ||
| + | ^ Example | ||
| ==== sysGetBuyPrice ==== | ==== sysGetBuyPrice ==== | ||
| Line 230: | Line 238: | ||
| </ | </ | ||
| - | ==== sysGetSellPrice==== | + | ==== sysGetSellPrice ==== |
| - | Example : '' | + | ^ Format | sysGetSellPrice( [Item_Name or Num] )| |
| - | TBD\\ | + | ^ Description | Returns the price that the item is currently set for sale at (Or 0 if it is not currently for sale) | |
| + | ^ Parameters | Item Name or number | | ||
| + | //Example//: | ||
| + | < | ||
| + | < | ||
| + | { | ||
| + | osdcreate( OSDBUILDING, | ||
| + | | ||
| + | if ( $woodSellPrice == 0 ) | ||
| + | { | ||
| + | osdaddat( TEXT, 100, 100, 400, 0, "", | ||
| + | } | ||
| + | else | ||
| + | { | ||
| + | $woodSellPriceText = sysGetPriceText( $woodSellPrice ) | ||
| + | osdaddat( TEXT, 100, 100, 400, 0, "", | ||
| + | } | ||
| + | osdactivate() | ||
| + | } | ||
| + | </ | ||
| + | </ | ||
| ==== sysGetEmployeeID ==== | ==== sysGetEmployeeID ==== | ||
| ^ Format | sysGetEmployeeID( [Index] ) | | ^ Format | sysGetEmployeeID( [Index] ) | | ||
| Line 240: | Line 267: | ||
| ^ Returns | PlayerID of the employee or 0 if none is set for this index | | ^ Returns | PlayerID of the employee or 0 if none is set for this index | | ||
| // | // | ||
| - | < | + | < |
| { | { | ||
| osdcreate( OSDBUILDING, | osdcreate( OSDBUILDING, | ||
| Line 253: | Line 280: | ||
| osdaddat( TEXT, 100, 100, 400, 0, "", | osdaddat( TEXT, 100, 100, 400, 0, "", | ||
| } | } | ||
| - | | + | |
| } | } | ||
| </ | </ | ||
| Line 301: | Line 328: | ||
| ==== sysAddBuilding ==== | ==== sysAddBuilding ==== | ||
| - | TBD\\ | + | ^ Format | sysAddBuilding ( [Building Type], [Owner ID], [MapX], [MapY], [ [Building_Name], |
| + | ^ Description | Used to add a new building to your world | | ||
| + | ^ Parameters | Building Type number | | ||
| + | ^ | Owner player ID | | ||
| + | ^ | Map Coordinate X | | ||
| + | ^ | Map Coordinate Y | | ||
| + | ^ | (Optional) Building Name | | ||
| + | ^ | (Optional) Construction Amount 1 | | ||
| + | ^ | (Optional) Construction Amount 2 | | ||
| + | ^ Returns | 1 if the building was added to the world, 0 if not | | ||
| + | // | ||
| + | < | ||
| + | { | ||
| + | $nBuildingType = $gParam[1] | ||
| + | |||
| + | $valid = sysIsBuildingPositionValid( $nBuildingType ) | ||
| + | if ( $valid = 1 ) | ||
| + | { | ||
| + | $buildingName = sysGetTextEntry() | ||
| + | $didAdd = sysAddBuilding( nBuildingType, | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | </ | ||
| ==== sysAddBuildingWorld ==== | ==== sysAddBuildingWorld ==== | ||
| TBD\\ | TBD\\ | ||
| Line 509: | 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 525: | Line 595: | ||
| - | ===== Misc other functions | + | ===== Maths Functions |
| ==== sysRand ==== | ==== sysRand ==== | ||
| - | Example : '' | + | ^ Format | sysRand |
| - | | + | ^ Description | Returns |
| - | + | ^ Example | |
| - | ==== sysRealTime ==== | + | |
| - | ^ Format | sysRealTime | + | |
| - | ^ Description | Returns | + | |
| - | ^ Parameters | Type field specifying the date or time to fetch | | + | |
| - | ^ Returns | Depending on the type field: | | + | |
| - | ^ | **Year** - returns the current year (e.g. 2014) | | + | |
| - | ^ | **Month** - returns the current month number | + | |
| - | ^ | **Day** - returns | + | |
| - | ^ | **Hour** - returns the current hour (0 to 23) | | + | |
| - | ^ | **Minute** - returns the current minute (0 to 59) | | + | |
| - | ^ | **Second** - returns the current second (0 to 59) | | + | |
| - | ^ | **UnixTime** - number of seconds passed since 1st Jan, 1970 | | + | |
| - | // | + | |
| - | < | + | |
| - | { | + | |
| - | $hour = sysRealTime( " | + | |
| - | if ( $hour < 18 ) | + | |
| - | { | + | |
| - | | + | |
| - | } | + | |
| - | else if ( $hour >= 20 ) | + | |
| - | { | + | |
| - | | + | |
| - | } | + | |
| - | else | + | |
| - | { | + | |
| - | *notifylarge %PLAYER% Tea-time! | + | |
| - | } | + | |
| - | } | + | |
| - | </ | + | |
| - | </ | + | |
| - | ==== sysGetDist ==== | + | |
| - | ^ Format | + | |
| - | ^ 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 | + | |
| - | } | + | |
| - | </ | + | |
| - | </ | + | |
| ==== sysSin ==== | ==== sysSin ==== | ||
| Line 608: | Line 633: | ||
| // | // | ||
| \\ | \\ | ||
| + | |||
| + | ==== 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 ===== | ||
| + | |||
| + | ==== sysRealTime ==== | ||
| + | ^ Format | sysRealTime ( [Type] )| | ||
| + | ^ Description | Returns details of the current real time (according to the server clock)| | ||
| + | ^ Parameters | Type field specifying the date or time to fetch | | ||
| + | ^ Returns | Depending on the type field: | | ||
| + | ^ | **Year** - returns the current year (e.g. 2014) | | ||
| + | ^ | **Month** - returns the current month number (1 to 12) | | ||
| + | ^ | **Day** - returns the current day number (1 to 31) | | ||
| + | ^ | **Hour** - returns the current hour (0 to 23) | | ||
| + | ^ | **Minute** - returns the current minute (0 to 59) | | ||
| + | ^ | **Second** - returns the current second (0 to 59) | | ||
| + | ^ | **UnixTime** - number of seconds passed since 1st Jan, 1970 | | ||
| + | // | ||
| + | < | ||
| + | { | ||
| + | $hour = sysRealTime( " | ||
| + | if ( $hour < 18 ) | ||
| + | { | ||
| + | *msg %PLAYER% Tea can only be used at tea-time (6pm - 8pm) | ||
| + | } | ||
| + | else if ( $hour >= 20 ) | ||
| + | { | ||
| + | *msg %PLAYER% Tea can only be used at tea-time (6pm - 8pm) | ||
| + | } | ||
| + | else | ||
| + | { | ||
| + | *notifylarge %PLAYER% Tea-time! | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | </ | ||
| ==== sysRaceIsActive ==== | ==== sysRaceIsActive ==== | ||
| TBD \\ | TBD \\ | ||
| \\ | \\ | ||
scripting/reference/system_functions.1424699149.txt.gz · Last modified: (external edit)
