User Tools

Site Tools


scripting:other_language_features

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
scripting:other_language_features [2020/01/28 18:17] – [Custom Events] 51.148.136.100scripting:other_language_features [2023/05/15 02:31] (current) mit
Line 21: Line 21:
 </code> </code>
 Keeping related code separated like this can make it easier to share script across worlds - e.g. You could add your crow tournament feature to another world by copying the ''CrowTournament.mit'' file across and including it from the ServerScript. Keeping related code separated like this can make it easier to share script across worlds - e.g. You could add your crow tournament feature to another world by copying the ''CrowTournament.mit'' file across and including it from the ServerScript.
 +
 +===== Persistent Key Values =====
 +
 +You can create persistent/saved variable & data that are attached to a player, a building or the world/server. Keys are referenced by their name, can be created at any point and can store integers or strings.
 +
 +<code>
 +Event( "AccessBuilding", "" )
 +{
 +   $gPlayerKey[AccessCount] += 1
 +   $gBuildingKey[LastPlayerAccessed] = $gPlayerID
 +   $gServerKey[LastBuildingAccessed] = $gBuildingNum
 +}
 +</code>
 +
 +Barring sudden outages, key values will be saved and restored whenever the server is restarted.
 +
  
 ===== Timers ===== ===== Timers =====
scripting/other_language_features.1580257044.txt.gz · Last modified: 2020/01/28 18:17 by 51.148.136.100

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