User Tools

Site Tools


scripting:reference:system_functions:textfunctions

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:textfunctions [2020/01/30 07:07] mitscripting: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 "PlayerKilled" and "RobocrowKilled" events) +**%KILLER%** : Name of the player who killed the player (Applicable in "PlayerKilled" and "RobocrowKilled" events)\\ 
-**%TARGET%** : Name of the target of an event (e.g. "BarterRequest", "MenuOption" and 'Battle'events. Also sometimes valid in "UseItem" if the targeting system is active). +**%TARGET%** : Name of the target of an event (e.g. "BarterRequest", "MenuOption" and 'Battle'events. Also sometimes valid in "UseItem" if the targeting system is active).\\ 
 +\\
 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( [PlayerID)|+^ 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 |
 //Example//: <note> //Example//: <note>
Line 33: Line 32:
  
 ==== sysGetItemNum ==== ==== sysGetItemNum ====
-^ Format | sysGetItemNum( [Item Name)|+^ 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 |
 //Example//: <note> //Example//: <note>
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 |
 //Example//: <note> //Example//: <note>
 <code>Event( "UseItem", "Potion" ) <code>Event( "UseItem", "Potion" )
Line 72: Line 70:
 </note> </note>
 ==== sysGetDateText ==== ==== sysGetDateText ====
-^ Format | sysGetDateText( [Unix Time] )|+^ Format | sysGetDateText( Unix_Time )|
 ^ 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) |
 //Example//: <note> //Example//: <note>
 <code>Event( "UseItem", "Potion" ) <code>Event( "UseItem", "Potion" )
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".. if you pass 28920 it'll be "8 hours and 2 minutes"
 +^ Returns | Text representation of given time period | 
 +//Example//: <note> 
 +<code>Event( "&command", "TimeSinceLast"
 +
 +    $currTime = sysRealTime( "UnixTime" )  
 +    $lastTime = $gPlayerKey["TimeSinceLast"
 +    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["TimeSinceLast"] = $currTime 
 +
 +</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", if the result is 36000 seconds it'll return "10 hours"  |
-^ Parameters | Number of game days |+
 ^ Returns | Time text | ^ Returns | Time text |
 //Example//: <note> //Example//: <note>
scripting/reference/system_functions/textfunctions.1580389623.txt.gz · Last modified: 2020/01/30 07:07 by mit

Except where otherwise noted, content on this wiki is licensed under the following license: Public Domain
Public Domain Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki