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 = golden sword, iron sword, diamond sword

Auto Reload

🔗

New

Structure

Patterns:
  • auto[matically] reload [(this|the) script]
Required Entries:
Optional Entries: recipients, permission
Since: 2.13
Place at the top of a script file to enable and configure automatic reloading of the script. When the script is saved, Skript will automatically reload the script. The config.sk node 'script loader thread size' must be set to a positive number (async or parallel loading) for this to be enabled.

available optional nodes:     recipients: The players to send reload messages to. Defaults to console.     permission: The permission required to receive reload messages. 'recipients' will override this node.

Examples:

auto reload

auto reload:
    recipients: "SkriptDev", "61699b2e-d327-4a01-9f1e-0ea8c3f06bc6" and "Njol"
    permission: "skript.reloadnotify"

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

Event

🔗

Structure

Patterns:
  • [on] [uncancelled|cancelled|(any|all)] <.+> [with priority ((lowest|low|normal|high|highest|monitor))]
Since: 1.0
2.6 (per-event priority)
2.9 (listening to cancellable events)
The structure used for listening to events.

Optionally allows specifying whether to listen to events that have been cancelled, and allows specifying with which priority to listen to events. Events are called in the following order of priorities.

``` lowest -> low -> normal -> high -> highest -> monitor ```

Modifying event-values or cancelling events is not supported when using the 'monitor' priority. It should only be used for monitoring the outcome of an event.

Examples:

on load:
    broadcast "loading!"

on join:
    if {first-join::%player's uuid%} is not set:
        set {first-join::%player's uuid%} to now

cancelled block break:
    send "<red>You can't break that here" to player

on join with priority lowest:
    # called first

on join:
    # called second

on join with priority highest:
    # called last

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!"

Using Experimental Feature

🔗

Structure

Patterns:
  • using [[the] experiment] <.+>
Since: 2.9.0
Place at the top of a script file to enable an optional experimental feature.
Experimental features may change behavior in Skript and may contain bugs. Use at your own discretion.
A list of the available experimental features can be found in the changelog for your version of Skript.

Examples:

using 1.21
using the experiment my-cool-addon-feature

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%}%"