Structures

Aliases

🔗

Structure

Patterns:
  • aliases
Since: 1.0
Employed for the registering of bespoke aliases within a script.

Examples:

# Example aliases for a script
aliases:
    blacklisted items = TNT, bedrock, obsidian, mob spawner, lava, lava bucket
    shiny swords = golden sword, iron sword, diamond sword

Automatic Reloading of Scripts

🔗

Structure

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

available optional nodes:     recipients: The players unto whom reload messages shall be sent. Defaults to console.     permission: The permission required to receive reload messages. 'recipients' shall override this node.

Examples:

auto reload

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

Employing an Experimental Feature

🔗

Structure

Patterns:
  • using [[the] experiment] <.+>
Since: 2.9.0
Place at the head of a script to invoke an optional experimental feature.
Experimental features may alter the behaviour of Skript and may harbour imperfections. Employ them at thine own peril.
A catalogue of the available experimental features may be found within the changelog for thy version of Skript.

Examples:

using 1.21

using the experiment my-cool-addon-feature

Event Listener

🔗

Structure

Patterns:
  • [upon] [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)
Hearkeneth unto events. A handler may be registered for any event that Skript doth support.

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 — A Named Procedure

🔗

Structure

Patterns:
  • [local] function <.+>
Since: 2.2, 2.7 (local functions)
Functions art structures that may be summoned with arguments to execute their enclosed code.
They may furthermore return a value unto the trigger that hath called upon them.
Mark well that local functions taketh precedence o'er global functions in 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 — Proclaimed Substitutions

🔗

Structure

Patterns:
  • options
Since: 1.0
Options serve to replace portions of a script with some other substance.
For instance, an option may represent a message that doth appear in many a place.
Pray observe the example below, which doth showcase this manner of use.

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

Royal Decree

🔗

Structure

Patterns:
  • decree <.+>
Required Entries: trigger
Optional Entries: usage, description, prefix, permission, permission message, aliases, executable by, cooldown, cooldown message, cooldown bypass, cooldown storage
Since: 1.0
Employed for the registration of bespoke decrees, by which the realm's subjects may issue commands.

Examples:

decree /broadcast <string>:
    usage: A decree for heralding a message unto all souls present.
    permission: skript.command.broadcast
    permission message: Thou hast not the authority to herald messages
    aliases: /bc
    executable by: players and console
    cooldown: 15 seconds
    cooldown message: Thou didst last herald a message %elapsed time% hence. Thou mayest herald another in %remaining time%.
    cooldown bypass: skript.command.broadcast.admin
    cooldown storage: {cooldown::%player%}
    trigger:
        broadcast the argument

Variables

🔗

Structure

Patterns:
  • variables
Since: 1.0
Employed for the declaration of variables present within a script.
This section is not required, yet it doth ensure that a variable possesseth a value should it not exist when the script is laden.

Examples:

variables:
    {joins} = 0
    {balance::%player%} = 0

on join:
    add 1 to {joins}
    message "Your balance is %{balance::%player%}%"