scripting:other_language_features
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
scripting:other_language_features [2020/01/28 18:16] – [Includes] 51.148.136.100 | scripting:other_language_features [2023/05/15 02:31] (current) – mit | ||
---|---|---|---|
Line 21: | Line 21: | ||
</ | </ | ||
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 '' | 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 '' | ||
+ | |||
+ | ===== Persistent Key Values ===== | ||
+ | |||
+ | You can create persistent/ | ||
+ | |||
+ | < | ||
+ | Event( " | ||
+ | { | ||
+ | | ||
+ | | ||
+ | | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Barring sudden outages, key values will be saved and restored whenever the server is restarted. | ||
+ | |||
===== Timers ===== | ===== Timers ===== | ||
Line 50: | Line 66: | ||
Functions are defined in your script as shown in this example: | Functions are defined in your script as shown in this example: | ||
- | <codedoc> | + | <code> |
Function IsItemASword( $itemNum ) | Function IsItemASword( $itemNum ) | ||
{ | { | ||
Line 63: | Line 79: | ||
return( 0 ) | return( 0 ) | ||
} | } | ||
- | </codedoc> | + | </code> |
This example function would be called from another part of your script like this: | This example function would be called from another part of your script like this: | ||
- | <codedoc> | + | <code> |
$isSword = IsItemASword( $gTaskItem1 ) | $isSword = IsItemASword( $gTaskItem1 ) | ||
- | </codedoc> | + | </code> |
Functions can have any number of parameters, and always return a value. | Functions can have any number of parameters, and always return a value. | ||
Line 80: | Line 96: | ||
A custom event is defined as shown: | A custom event is defined as shown: | ||
- | <codedoc> | + | <code> |
| | ||
{ | { | ||
*say My Custom Event has been triggered for %PLAYER% | *say My Custom Event has been triggered for %PLAYER% | ||
} | } | ||
- | </codedoc> | + | </code> |
This custom event can be triggered using the command '' | This custom event can be triggered using the command '' | ||
- | <codedoc> | + | <code> |
| | ||
- | </codedoc> | + | </code> |
would display '' | would display '' | ||
scripting/other_language_features.1580256994.txt.gz · Last modified: 2020/01/28 18:16 by 51.148.136.100