Structures

Aliases

🔗

Structure

Patterns:
  • aliases
Since: 1.0
Used for registering custom aliases for a script.

Examples:

aliases:
    blacklisted items = TNT, bedrock, obsidian, mob spawner, lava, lava bucket
    shiny swords = gold sword, iron sword, diamond sword

Command

🔗

Structure

Patterns:
  • command <.+>
Required Entries: trigger
Optional Entries: usage, description, prefix, permission, permission message, aliases, executable by, cooldown, cooldown message, cooldown bypass, cooldown storage
Since: 1.0
Used for registering custom commands.

Examples:

command /broadcast <string>:
    usage: A command for broadcasting a message to all players.
    permission: skript.command.broadcast
    permission message: You don't have permission to broadcast messages
    aliases: /bc
    executable by: players and console
    cooldown: 15 seconds
    cooldown message: You last broadcast a message %elapsed time% ago. You can broadcast another message in %remaining time%.
    cooldown bypass: skript.command.broadcast.admin
    cooldown storage: {cooldown::%player%}
    trigger:
        broadcast the argument

Function

🔗

Structure

Patterns:
  • [local] function <.+>
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}%}

Options

🔗

Structure

Patterns:
  • options
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!"

Variables

🔗

Structure

Patterns:
  • variables
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%}%"