scripting:reference:system_functions:textfunctions
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
scripting:reference:system_functions:textfunctions [2020/01/30 07:07] – mit | scripting:reference:system_functions:textfunctions [2020/02/07 03:13] (current) – mit | ||
---|---|---|---|
Line 3: | Line 3: | ||
Special text codes are used to get the names of things associated with the current script context, these are: | Special text codes are used to get the names of things associated with the current script context, these are: | ||
- | **%PLAYER%** : Name of the player | + | **%PLAYER%** : Name of the player |
- | **%BUILDINGOWNER%** : Name of the owner of the building in context (where applicable) | + | **%BUILDINGOWNER%** : Name of the owner of the building in context (where applicable)\\ |
- | **%KILLER%** : Name of the player who killed the player (Applicable in " | + | **%KILLER%** : Name of the player who killed the player (Applicable in " |
- | **%TARGET%** : Name of the target of an event (e.g. " | + | **%TARGET%** : Name of the target of an event (e.g. " |
+ | \\ | ||
Other system functions allow you to get the names and text representations of different aspects of your world, and convert from a text name to an ID number and vice versa: | Other system functions allow you to get the names and text representations of different aspects of your world, and convert from a text name to an ID number and vice versa: | ||
==== sysGetPlayerName ==== | ==== sysGetPlayerName ==== | ||
- | ^ Format | sysGetPlayerName( | + | ^ Format | sysGetPlayerName( PlayerID )| |
^ Description | Returns the name of the specified player| | ^ Description | Returns the name of the specified player| | ||
- | ^ Parameters | Player ID | | ||
^ Returns | Player Name | | ^ Returns | Player Name | | ||
// | // | ||
Line 33: | Line 32: | ||
==== sysGetItemNum ==== | ==== sysGetItemNum ==== | ||
- | ^ Format | sysGetItemNum( | + | ^ Format | sysGetItemNum( Item Name )| |
^ Description | Gets an item number from a name| | ^ Description | Gets an item number from a name| | ||
- | ^ Parameters | Item Name | | ||
^ Returns | Item number | | ^ Returns | Item number | | ||
// | // | ||
Line 50: | Line 48: | ||
==== sysGetPriceText ==== | ==== sysGetPriceText ==== | ||
- | ^ Format | sysGetPriceText ( [Price] )| | + | ^ Format | sysGetPriceText ( Price )| |
^ Description | Returns a text string displaying the price value expressed in a short format - e.g 2s 3d | | ^ Description | Returns a text string displaying the price value expressed in a short format - e.g 2s 3d | | ||
- | ^ Parameters | Price value (in denari) | | ||
^ Returns | Price text | | ^ Returns | Price text | | ||
+ | ^ Notes | Price parameter is the value in denari | | ||
// | // | ||
< | < | ||
Line 72: | Line 70: | ||
</ | </ | ||
==== sysGetDateText ==== | ==== sysGetDateText ==== | ||
- | ^ Format | sysGetDateText( | + | ^ Format | sysGetDateText( |
^ Description | Returns a text string displaying the date and time | | ^ Description | Returns a text string displaying the date and time | | ||
- | ^ Parameters | Unix time (Number of seconds since 1 Jan 1970) | | ||
^ Returns | Text of the date and time (e.g. "31st December 2014 18:00" ) | | ^ Returns | Text of the date and time (e.g. "31st December 2014 18:00" ) | | ||
+ | ^ Notes | Parameter is 'Unix time' ; (Number of seconds since 1 Jan 1970) | | ||
// | // | ||
< | < | ||
Line 98: | Line 96: | ||
==== sysGetTimeText ==== | ==== sysGetTimeText ==== | ||
- | TBD // | + | ^ Format | sysGetTimeText ( Num_seconds )| |
- | // | + | ^ Description | Returns text form of the time provided in seconds using the most appropriate resolution ; i.e. if you pass 110 seconds, the text will be "1 minute and 50 seconds" |
+ | ^ Returns | Text representation of given time period | | ||
+ | //Example//: < | ||
+ | < | ||
+ | { | ||
+ | $currTime = sysRealTime( " | ||
+ | $lastTime = $gPlayerKey[" | ||
+ | if ( $lastTime == 0 ) | ||
+ | { | ||
+ | *msg %PLAYER% This is the first time you've used this command | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | $timeSince = $currTime - $lastTime | ||
+ | $timeSinceText = sysGetTimeText( $timeSince ) | ||
+ | *msg %PLAYER% It has been $timeSinceText since you last used this command | ||
+ | } | ||
+ | $gPlayerKey[" | ||
+ | } | ||
+ | </code> | ||
+ | </note> | ||
==== sysGetRealTimeTextForDays ==== | ==== sysGetRealTimeTextForDays ==== | ||
- | ^ Format | sysGetRealTimeTextForDays ( [Number of game days] )| | + | ^ Format | sysGetRealTimeTextForDays ( Number_of_game_days |
- | ^ Description | Returns a text description of the time that will pass for the specified number of game days | | + | ^ Description | Returns a text description of the time that will pass for the specified number of game days, using the most appropriate resolution. (e.g. If the result is 30 seconds, it'll return "30 seconds", |
- | ^ Parameters | Number of game days | | + | |
^ Returns | Time text | | ^ Returns | Time text | | ||
// | // |
scripting/reference/system_functions/textfunctions.1580389623.txt.gz · Last modified: 2020/01/30 07:07 by mit