Patterns: |
|
Since: | 2.2, 2.7 (local functions) |
Functions are structures that can be executed with arguments/parameters to run code. They can also return a value to the trigger that is executing the function. Note that local functions come before global functions execution
Examples:
function sayMessage(message: text):
broadcast {_message} # our message argument is available in '{_message}'
local function giveApple(amount: number) :: item:
return {_amount} of apple
function getPoints(p: player) returns number:
return {points::%{_p}%}
broadcast {_message} # our message argument is available in '{_message}'
local function giveApple(amount: number) :: item:
return {_amount} of apple
function getPoints(p: player) returns number:
return {points::%{_p}%}
Patterns: |
|
Since: | 1.0 |
Options are used for replacing parts of a script with something else. For example, an option may represent a message that appears in multiple locations. Take a look at the example below that showcases this.
Examples:
options:
no_permission: You're missing the required permission to execute this command!
command /ping:
permission: command.ping
permission message: {@no_permission}
trigger:
message "Pong!"
command /pong:
permission: command.pong
permission message: {@no_permission}
trigger:
message "Ping!"
no_permission: You're missing the required permission to execute this command!
command /ping:
permission: command.ping
permission message: {@no_permission}
trigger:
message "Pong!"
command /pong:
permission: command.pong
permission message: {@no_permission}
trigger:
message "Ping!"
Patterns: |
|
Since: | 1.0 |
Used for defining variables present within a script. This section is not required, but it ensures that a variable has a value if it doesn't exist when the script is loaded.
Examples:
variables:
{joins} = 0
{balance::%player%} = 0
on join:
add 1 to {joins}
message "Your balance is %{balance::%player%}%"
{joins} = 0
{balance::%player%} = 0
on join:
add 1 to {joins}
message "Your balance is %{balance::%player%}%"