How to use Skript

Three levels of working examples, each explained line by line, plus every in-depth guide on the site.

Beginner: events and commands

Every script is built from triggers: a header line ending in a colon, and indented lines that run when it fires.

Your first event

welcome.sk
on join:
    send "&aWelcome, %player%!" to player

on join fires when any player joins. Inside it, player is the player who joined. &a is a Minecraft colour code for green, and %player% inserts the player's name.

Your first command

discord.sk
command /discord:
    trigger:
        send "&bJoin our community: discord.gg/yourserver"

The trigger: section holds the code. Save, run /sk reload discord, and type /discord.

Intermediate: variables, conditions and loops

Variables and conditions

bounty.sk
on death of player:
    attacker is a player
    add 25 to {coins::%attacker's uuid%}
    send "&e+25 coins" to attacker

{coins::...} is a saved list variable keyed by UUID. The line attacker is a player is a condition; if it is false, the rest of the trigger is skipped.

If, else and loops

hourly.sk
every 1 hour:
    loop all players:
        if loop-player has permission "rank.vip":
            give loop-player 3 diamond
        else:
            give loop-player 1 diamond

loop all players repeats the block once per online player, with loop-player as the current one.

Advanced: functions, options and structure

Functions

functions.sk
function reward(p: player, amount: number):
    add {_amount} to {coins::%{_p}'s uuid%}
    send "&a+%{_amount}% coins" to {_p}

command /claim:
    cooldown: 1 day
    trigger:
        reward(player, 50)

Functions take typed parameters, which become local variables inside the function. Any script can call them after they load.

Options

shop.sk
options:
    prefix: &8[&6Shop&8]
    price: 50

command /price:
    trigger:
        send "{@prefix} &7Each diamond sells for &f{@price} coins."

Options are replaced when the script is parsed, so one change updates every use.

Keep scripts organised

Use one file per feature, put shared functions in their own file, and comment anything clever with # so future you understands it.

All guides