All Elements

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

All Scripts

🔗

Expression

Patterns:
  • [all [of the]|the] scripts [without ([subdirectory] paths|parents)]
  • [all [of the]|the] (enabled|loaded) scripts [without ([subdirectory] paths|parents)]
  • [all [of the]|the] (disabled|unloaded) scripts [without ([subdirectory] paths|parents)]
Since: 2.5
Return Type: Text
Returns all of the scripts, or just the enabled or disabled ones.

Examples:

command /scripts:
    trigger:
        send "All Scripts: %scripts%" to player
        send "Loaded Scripts: %enabled scripts%" to player
        send "Unloaded Scripts: %disabled scripts%" to player

Case Text

🔗

Expression

Patterns:
  • %texts% in (upper|lower)[ ]case
  • (upper|lower)[ ]case %texts%
  • capitali(s|z)ed %texts%
  • %texts% in [(lenient|strict) ](proper|title)[ ]case
  • [(lenient|strict) ](proper|title)[ ]case %texts%
  • %texts% in [(lenient|strict) ]camel[ ]case
  • [(lenient|strict) ]camel[ ]case %texts%
  • %texts% in [(lenient|strict) ]pascal[ ]case
  • [(lenient|strict) ]pascal[ ]case %texts%
  • %texts% in [(lower|upper|capital|screaming)[ ]]snake[ ]case
  • [(lower|upper|capital|screaming)[ ]]snake[ ]case %texts%
  • %texts% in [(lower|upper|capital)[ ]]kebab[ ]case
  • [(lower|upper|capital)[ ]]kebab[ ]case %texts%
Since: 2.2-dev16 (lowercase and uppercase), 2.5 (advanced cases)
Return Type: Text
Copy of given text in Lowercase, Uppercase, Proper Case, camelCase, PascalCase, Snake_Case, and Kebab-Case

Examples:

"Oops!" in lowercase # oops!
"oops!" in uppercase # OOPS!
"hellO i'm steve!" in proper case # HellO I'm Steve!
"hellO i'm steve!" in strict proper case # Hello I'm Steve!
"spAwn neW boSs ()" in camel case # spAwnNeWBoSs()
"spAwn neW boSs ()" in strict camel case # spawnNewBoss()
"geneRate ranDom numBer ()" in pascal case # GeneRateRanDomNumBer()
"geneRate ranDom numBer ()" in strict pascal case # GenerateRandomNumber()
"Hello Player!" in snake case # Hello_Player!
"Hello Player!" in lower snake case # hello_player!
"Hello Player!" in upper snake case # HELLO_PLAYER!
"What is your name?" in kebab case # What-is-your-name?
"What is your name?" in lower kebab case # what-is-your-name?
"What is your name?" in upper kebab case # WHAT-IS-YOUR-NAME?

Characters Between

🔗

Expression

Patterns:
  • [(all [[of] the]|the)] [alphanumeric] characters (between|from) %text% (and|to) %text%
Since: 2.8.0
Return Type: Text
All characters between two given characters, useful for generating random strings. This expression uses the Unicode numerical code of a character to determine which characters are between the two given characters. The ASCII table linked here shows this ordering for the first 256 characters. If you would like only alphanumeric characters you can use the 'alphanumeric' option in the expression. If strings of more than one character are given, only the first character of each is used.

Examples:

loop characters from "a" to "f":
    broadcast "%loop-value%"

# 0123456789:;<=>?@ABC... ...uvwxyz
send characters between "0" and "z"

# 0123456789ABC... ...uvwxyz
send alphanumeric characters between "0" and "z"

Colored / Uncolored

🔗

Expression

Patterns:
  • (colo[u]r-|colo[u]red )%texts%
  • (format-|formatted )%texts%
  • (un|non)[-](colo[u]r-|colo[u]red |format-|formatted )%texts%
Since: 2.0
Return Type: Text
Parses <color>s and, optionally, chat styles in a message or removes any colors and chat styles from the message. Parsing all chat styles requires this expression to be used in same line with the send effect.

Examples:

on chat:
    set message to colored message # Safe; only colors get parsed
command /fade &lt;player&gt;:
    trigger:
        set display name of the player-argument to uncolored display name of the player-argument
command /format &lt;text&gt;:
    trigger:
        message formatted text-argument # Safe, because we're sending to whoever used this command

Date Ago/Later

🔗

Expression

Patterns:
Since: 2.2-dev33
Return Type: Date
A date the specified timespan before/after another date.

Examples:

set {_yesterday} to 1 day ago
set {_hourAfter} to 1 hour after {someOtherDate}
set {_hoursBefore} to 5 hours before {someOtherDate}

Hash

🔗

Expression

Patterns:
  • %texts% hash[ed] with (MD5|SHA-256)
Since: 2.0, 2.2-dev32 (SHA-256 algorithm)
Return Type: Text
Hashes the given text using the MD5 or SHA-256 algorithms. Each algorithm is suitable for different use cases.

MD5 is provided mostly for backwards compatibility, as it is outdated and not secure. SHA-256 is more secure, and can used to hash somewhat confidental data like IP addresses and even passwords. It is not that secure out of the box, so please consider using salt when dealing with passwords! When hashing data, you must specify algorithms that will be used for security reasons!

Please note that a hash cannot be reversed under normal circumstanses. You will not be able to get original value from a hash with Skript.

Examples:

command /setpass &lt;text&gt;:
    trigger:
        set {password::%uuid of player%} to text-argument hashed with SHA-256
command /login &lt;text&gt;:
    trigger:
        if text-argument hashed with SHA-256 is {password::%uuid of player%}:
            message "Login successful."
        else:
            message "Wrong password!"

Index Of

🔗

Expression

Patterns:
  • [the] [(first|last)] index of %text% in %text%
Since: 2.1
Return Type: long
The first or last index of a character (or text) in a text, or -1 if it doesn't occur in the text. Indices range from 1 to the length of the text.

Examples:

set {_first} to the first index of "@" in the text argument
if {_s} contains "abc":
    set {_s} to the first (index of "abc" in {_s} + 3) characters of {_s} # removes everything after the first "abc" from {_s}

Indices of List

🔗

Expression

Patterns:
  • [(the|all [[of] the])] (indexes|indices) of %~objects%
  • %~objects%'[s] (indexes|indices)
  • [sorted] (indices|indexes) of %~objects% in (ascending|descending) order
  • [sorted] %~objects%'[s] (indices|indexes) in (ascending|descending) order
Since: 2.4 (indices), 2.6.1 (sorting)
Return Type: Text
Returns all the indices of a list variable, optionally sorted by their values. To sort the indices, all objects in the list must be comparable; Otherwise, this expression will just return the unsorted indices.

Examples:

set {l::*} to "some", "cool" and "values"
broadcast "%indices of {l::*}%" # result is 1, 2 and 3

set {_leader-board::first} to 17
set {_leader-board::third} to 30
set {_leader-board::second} to 25
set {_leader-board::fourth} to 42
set {_ascending-indices::*} to sorted indices of {_leader-board::*} in ascending order
broadcast "%{_ascending-indices::*}%" #result is first, second, third, fourth
set {_descending-indices::*} to sorted indices of {_leader-board::*} in descending order
broadcast "%{_descending-indices::*}%" #result is fourth, third, second, first

Length

🔗

Expression

Patterns:
Since: 2.1
Return Type: long
The length of a text, in number of characters.

Examples:

set {_l} to length of the string argument

Loaded Plugins

🔗

Expression

Patterns:
  • [(all [[of] the]|the)] [loaded] plugins
Since: 2.7
Return Type: Text
An expression to obtain a list of the names of the server's loaded plugins.

Examples:

if the loaded plugins contains "Vault":
    broadcast "This server uses Vault plugin!"

send "Plugins (%size of loaded plugins%): %plugins%" to player

Loop Iteration

🔗

Expression

Patterns:
  • [the] loop(-| )(counter|iteration)[-%*number%]
Since: 2.8.0
Return Type: long
Returns the loop's current iteration count (for both normal and while loops).

Examples:

while player is online:
    give player 1 stone
    wait 5 ticks
    if loop-counter > 30:
        stop loop

loop {top-balances::*}:
    if loop-iteration <= 10:
        broadcast "##%loop-iteration% %loop-index% has $%loop-value%"

Loop value

🔗

Expression

Patterns:
  • [the] loop-<.+>
Since: 1.0, 2.8.0 (loop-counter)
Return Type: Object
Returns the currently looped value.

Examples:

# Countdown
loop 10 times:
    message "%11 - loop-number%"
    wait a second

# Generate a 10x10 floor made of randomly colored wool below the player
loop blocks from the block below the player to the block 10 east of the block below the player:
    loop blocks from the loop-block to the block 10 north of the loop-block:
        set loop-block-2 to any wool

loop {top-balances::*}:
    loop-iteration <= 10
    send "##%loop-iteration% %loop-index% has $%loop-value%"

Now

🔗

Expression

Patterns:
  • now
Since: 1.4
Return Type: Date
The current system time of the server. Use time to get the Minecraft time of a world.

Examples:

broadcast "Current server time: %now%"

Number of Characters

🔗

Expression

Patterns:
  • number of upper[ ]case char(acters|s) in %text%
  • number of lower[ ]case char(acters|s) in %text%
  • number of digit char(acters|s) in %text%
Since: 2.5
Return Type: long
The number of uppercase, lowercase, or digit characters in a string.

Examples:

#Simple Chat Filter
on chat:
    if number of uppercase chars in message / length of message > 0.5
        cancel event
        send "&lt;red&gt;Your message has to many caps!" to player

Numbers

🔗

Expression

Patterns:
  • [(all [[of] the]|the)] (numbers|integers|decimals) (between|from) %number% (and|to) %number%
Since: 1.4.6 (integers & numbers), 2.5.1 (decimals)
Return Type: Number
All numbers between two given numbers, useful for looping. Use 'numbers' if your start is not an integer and you want to keep the fractional part of the start number constant, or use 'integers' if you only want to loop integers. You may also use 'decimals' if you want to use the decimal precision of the start number. You may want to use the 'times' expression instead, for instance 'loop 5 times:'

Examples:

loop numbers from 2.5 to 5.5: # loops 2.5, 3.5, 4.5, 5.5
loop integers from 2.9 to 5.1: # same as '3 to 5', i.e. loops 3, 4, 5
loop decimals from 3.94 to 4: # loops 3.94, 3.95, 3.96, 3.97, 3.98, 3.99, 4

Parse

🔗

Expression

Patterns:
Since: 2.0
Return Type: Object
Parses text as a given type, or as a given pattern. This expression can be used in two different ways: One which parses the entire text as a single instance of a type, e.g. as a number, and one that parses the text according to a pattern. If the given text could not be parsed, this expression will return nothing and the parse error will be set if some information is available. Some notes about parsing with a pattern: - The pattern must be a Skript pattern, e.g. percent signs are used to define where to parse which types, e.g. put a %number% or %items% in the pattern if you expect a number or some items there. - You have to save the expression's value in a list variable, e.g. set {parsed::*} to message parsed as "...". - The list variable will contain the parsed values from all %types% in the pattern in order. If a type was plural, e.g. %items%, the variable's value at the respective index will be a list variable, e.g. the values will be stored in {parsed::1::*}, not {parsed::1}.

Examples:

set {var} to line 1 parsed as number
on chat:
    set {var::*} to message parsed as "buying %items% for %money%"
    if parse error is set:
        message "%parse error%"
    else if {var::*} is set:
        cancel event
        remove {var::2} from the player's balance
        give {var::1::*} to the player

Parse Error

🔗

Expression

Patterns:
  • [the] [last] [parse] error
Since: 2.0
Return Type: Text
The error which caused the last parse operation to fail, which might not be set if a pattern was used and the pattern didn't match the provided text at all.

Examples:

set {var} to line 1 parsed as integer
if {var} is not set:
    parse error is set:
        message "&lt;red&gt;Line 1 is invalid: %last parse error%"
    else:
        message "&lt;red&gt;Please put an integer on line 1!"

Percent of

🔗

Expression

Patterns:
Since: 2.8.0
Return Type: Number
Returns a percentage of one or more numbers.

Examples:

set damage to 10% of victim's health
set damage to 125 percent of damage
set {_result} to {_percent} percent of 999
set {_result::*} to 10% of {_numbers::*}
set experience to 50% of player's total experience

Question

🔗

Expression

Patterns:
Since: 3.0
Return Type: Text
Asks a question and returns the answer.

Examples:

set {answer} to answer of "What is your name?"

Random

🔗

Expression

Patterns:
Since: 1.4.9
Return Type: Object
Gets a random item out of a set, e.g. a random player out of all players online.

Examples:

give a diamond to a random player out of all players
give a random item out of all items to the player

Random Character

🔗

Expression

Patterns:
  • [a|%integer%] random [alphanumeric] character[s] (from|between) %text% (to|and) %text%
Since: 2.8.0
Return Type: Text
One or more random characters between two given characters. Use 'alphanumeric' if you want only alphanumeric characters. This expression uses the Unicode numerical code of a character to determine which characters are between the two given characters. If strings of more than one character are given, only the first character of each is used.

Examples:

set {_captcha} to join (5 random characters between "a" and "z") with ""
send 3 random alphanumeric characters between "0" and "z"

Random Number

🔗

Expression

Patterns:
  • [a] random (integer|number) (from|between) %number% (to|and) %number%
Since: 1.4
Return Type: Number
A random number or integer between two given numbers. Use 'number' if you want any number with decimal parts, or use use 'integer' if you only want whole numbers. Please note that the order of the numbers doesn't matter, i.e. random number between 2 and 1 will work as well as random number between 1 and 2.

Examples:

set the player's health to a random number between 5 and 10
send "You rolled a %random integer from 1 to 6%!" to the player

Random UUID

🔗

Expression

Patterns:
  • [a] random uuid
Since: 2.5.1
Return Type: Text
Returns a random UUID.

Examples:

set {_uuid} to random uuid

Repeat String

🔗

Expression

Patterns:
  • %texts% repeated %integer% time[s]
Since: 2.8.0
Return Type: Text
Repeats inputted strings a given amount of times.

Examples:

broadcast nl and nl repeated 200 times
broadcast "Hello World " repeated 5 times
if "aa" repeated 2 times is "aaaa":
    broadcast "Ahhhh" repeated 100 times

Reversed List

🔗

Expression

Patterns:
Since: 2.4
Return Type: Object
Reverses given list.

Examples:

set {_list::*} to reversed {_list::*}

Rounding

🔗

Expression

Patterns:
  • [(a|the)] round[ed] down %number%
  • [(a|the)] round[ed] %number%
  • [(a|the)] round[ed] up %number%
Since: 2.0
Return Type: long
Rounds numbers normally, up (ceiling) or down (floor) respectively.

Examples:

set {var} to rounded health of player
set line 1 of the block to rounded "%(1.5 * player's level)%"
add rounded down argument to the player's health

Script Name

🔗

Expression

Patterns:
  • [the] script[['s] name]
  • name of [the] script
Since: 2.0
Usable in events: Script Load/Unload
Return Type: Text
Holds the current script's name (the file name without '.sk').

Examples:

on script load:
    set {running::%script%} to true
on script unload:
    set {running::%script%} to false

Sets

🔗

Expression

Patterns:
  • [all [[of] the]|the|every] %*type%
Since: 1.0 pre-5, 2.7 (classinfo)
Return Type: Object
Returns a list of all the values of a type. Useful for looping.

Examples:

loop all attribute types:
    set loop-value attribute of player to 10
    message "Set attribute %loop-value% to 10!"

Shuffled List

🔗

Expression

Patterns:
Since: 2.2-dev32
Return Type: Object
Shuffles given list randomly. This is done by replacing indices by random numbers in resulting list.

Examples:

set {_list::*} to shuffled {_list::*}

Sorted List

🔗

Expression

Patterns:
Since: 2.2-dev19
Return Type: Object
Sorts given list in natural order. All objects in list must be comparable; if they're not, this expression will return nothing.

Examples:

set {_sorted::*} to sorted {_players::*}

Substring

🔗

Expression

Patterns:
  • [the] (part|sub[ ](text|string)) of %texts% (between|from) [ind(ex|ices)|character[s]] %number% (and|to) [(index|character)] %number%
  • [the] (first|last) [%number%] character[s] of %texts%
  • [the] %number% (first|last) characters of %texts%
  • [the] character[s] at [(index|position|indexes|indices|positions)] %numbers% (in|of) %texts%
Since: 2.1, 2.5.2 (character at, multiple strings support)
Return Type: Text
Extracts part of a text. You can either get the first <x> characters, the last <x> characters, the character at index <x>, or the characters between indices <x> and <y>. The indices <x> and <y> should be between 1 and the length of the text (other values will be fit into this range).

Examples:

set {_s} to the first 5 characters of the text argument
message "%subtext of {_s} from characters 2 to (the length of {_s} - 1)%" # removes the first and last character from {_s} and sends it to the player or console
set {_characters::*} to characters at 1, 2 and 7 in player's display name
send the last character of all players' names

Time Since

🔗

Expression

Patterns:
  • [the] time since %dates%
Since: 2.5
Return Type: Timespan
The time that has passed since a date. If the given date is in the future, a value will not be returned.

Examples:

send "%time since 5 minecraft days ago% has passed since 5 minecraft days ago!" to player

Unix Date

🔗

Expression

Patterns:
Since: 2.5
Return Type: Date
Converts given Unix timestamp to a date. The Unix timespan represents the number of seconds elapsed since 1 January 1970.

Examples:

unix date of 946684800 #1 January 2000 12:00 AM (UTC Time)

Unix Timestamp

🔗

Expression

Patterns:
  • [the] unix timestamp of %dates%
  • %dates%'[s] unix timestamp
Since: 2.2-dev31
Return Type: Number
Converts given date to Unix timestamp. This is roughly how many seconds have elapsed since 1 January 1970.

Examples:

unix timestamp of now

Value Within

🔗

Expression

Patterns:
Since: 2.7
Return Type: Object
Gets the value within objects. Usually used with variables to get the value they store rather than the variable itself, or with lists to get the values of a type.

Examples:

set {_entity} to a random entity out of all entities
delete entity within {_entity} # This deletes the entity itself and not the value stored in the variable

set {_list::*} to "something", 10, "test" and a zombie
broadcast the strings within {_list::*} # "something", "test"

Cancel Event

🔗

Effect

Patterns:
  • cancel [the] event
  • uncancel [the] event
Since: 1.0
Cancels the event (e.g. prevent blocks from being placed, or damage being taken).

Examples:

on damage:
    victim is a player
    victim has the permission "skript.god"
    cancel the event

Change: Set/Add/Remove/Delete/Reset

🔗

Effect

Patterns:
Since: 1.0 (set, add, remove, delete), 2.0 (remove all)
A very general effect that can change many expressions. Many expressions can only be set and/or deleted, while some can have things added to or removed from them.

Examples:

# set:
Set the player's display name to "&lt;red&gt;%name of player%"
set the block above the victim to lava
# add:
add 2 to the player's health # preferably use '<a href='#EffHealth'>heal</a>' for this
add argument to {blacklist::*}
give a diamond pickaxe of efficiency 5 to the player
increase the data value of the clicked block by 1
# remove:
remove 2 pickaxes from the victim
subtract 2.5 from {points::%uuid of player%}
# remove all:
remove every iron tool from the player
remove all minecarts from {entitylist::*}
# delete:
delete the block below the player
clear drops
delete {variable}
# reset:
reset walk speed of player
reset chunk at the targeted block

Continue

🔗

Effect

Patterns:
  • continue [this loop|[the] [current] loop]
  • continue [the] %*integer%(st|nd|rd|th) loop
Since: 2.2-dev37, 2.7 (while loops), 2.8.0 (outer loops)
Moves the loop to the next iteration. You may also continue an outer loop from an inner one. The loops are labelled from 1 until the current loop, starting with the outermost one.

Examples:

# Broadcast online moderators
loop all players:
    if loop-value does not have permission "moderator":
        continue # filter out non moderators
    broadcast "%loop-player% is a moderator!" # Only moderators get broadcast

# Game starting counter
set {_counter} to 11
while {_counter} > 0:
    remove 1 from {_counter}
    wait a second
    if {_counter} != 1, 2, 3, 5 or 10:
        continue # only print when counter is 1, 2, 3, 5 or 10
    broadcast "Game starting in %{_counter}% second(s)"

Copy Into Variable

🔗

Effect

Patterns:
Since: 2.8.0
Copies objects into a variable. When copying a list over to another list, the source list and its sublists are also copied over. Note: Copying a value into a variable/list will overwrite the existing data.

Examples:

set {_foo::bar} to 1
set {_foo::sublist::foobar} to "hey"
copy {_foo::*} to {_copy::*}
broadcast indices of {_copy::*} # bar, sublist
broadcast {_copy::bar} # 1
broadcast {_copy::sublist::foobar} # "hey!"

Delay

🔗

Effect

Patterns:
Since: 1.4
Delays the script's execution by a given timespan. Please note that delays are not persistent, e.g. trying to create a tempban script with ban player → wait 7 days → unban player will not work if you restart your server anytime within these 7 days. You also have to be careful even when using small delays!

Examples:

wait 2 minutes
halt for 5 minecraft hours
wait a tick

Do If

🔗

Effect

Patterns:
  • <.+> if <.+>
Since: 2.3
Execute an effect if a condition is true.

Examples:

on join:
    give a diamond to the player if the player has permission "rank.vip"

Enable/Disable/Reload Script File

🔗

Effect

Patterns:
  • ((enable|load)|reload|(disable|unload)) s(c|k)ript [file] %text%
Since: 2.4
Enables, disables, or reloads a script file.

Examples:

reload script "test"
enable script file "testing"
unload script file "script.sk"

Exit

🔗

Effect

Patterns:
  • (exit|stop) [trigger]
  • (exit|stop) [(1|a|the|this)] (section|loop|conditional)
  • (exit|stop) <\d+> (section|loop|conditional)s
  • (exit|stop) all (section|loop|conditional)s
Since: unknown (before 2.1)
Exits a given amount of loops and conditionals, or the entire trigger.

Examples:

if player has any ore:
    stop
message "%player% has no ores!"
loop blocks above the player:
    loop-block is not air:
        exit 2 sections
    set loop-block to water

Exit Program

🔗

Effect

Patterns:
  • exit (program|app|application)
  • exit (program|app|application) with code %number%
Since: 3.0
Exit the program with or without a custom exit code.

Examples:

on main:
    log "Hello World" to the console
exit program

Locally Suppress Warning

🔗

Effect

Patterns:
  • [local[ly]] suppress [the] (conflict|variable save|[missing] conjunction[s]|starting [with] expression[s]) warning[s]
Since: 2.3
Suppresses target warnings from the current script.

Examples:

locally suppress missing conjunction warnings
suppress the variable save warnings

Log

🔗

Effect

Patterns:
Since: 2.0
Writes text into a .log file. Skript will write these files to /.skript/logs. NB: Using 'server.log' as the log file will write to the default server log. Omitting the log file altogether will log the message as '[Skript] [<script>.sk] <message>' in the server log.

Examples:

on place of TNT:
    log "%player% placed TNT in %world% at %location of block%" to "tnt/placement.log"

LogToConsole

🔗

Effect

Patterns:
  • (log|write) %texts% to the (console|terminal|output|log)
Since: 3.0
Writes text to the console.

Examples:

on main:
    log "%player% placed TNT in %world% at %location of block%" to the console

Return

🔗

Effect

Patterns:
Since: 2.2, 2.8.0 (returns aliases)
Makes a function return a value

Examples:

function double(i: number) :: number:
    return 2 * {_i}

function divide(i: number) returns number:
    return {_i} / 2

Comparison

🔗

Condition

Patterns:
  • [(neither)] %objects% ((is|are)[(n't| not| neither)] ((greater|more|higher|bigger|larger) than|above)|>) %objects%
  • [(neither)] %objects% ((is|are)[(n't| not| neither)] (greater|more|higher|bigger|larger|above) [than] or (equal to|the same as)|>=) %objects%
  • [(neither)] %objects% ((is|are)[(n't| not| neither)] ((less|smaller|lower) than|below)|<) %objects%
  • [(neither)] %objects% ((is|are)[(n't| not| neither)] (less|smaller|lower|below) [than] or (equal to|the same as)|<=) %objects%
  • [(neither)] %objects% ((is|are) (not|neither)|isn't|aren't|!=) [equal to] %objects%
  • [(neither)] %objects% (is|are|=) [(equal to|the same as)] %objects%
  • [(neither)] %objects% (is|are) between %objects% and %objects%
  • [(neither)] %objects% (is not|are not|isn't|aren't) between %objects% and %objects%
  • [(neither)] %objects% (was|were)[(n't| not| neither)] ((greater|more|higher|bigger|larger) than|above) %objects%
  • [(neither)] %objects% (was|were)[(n't| not| neither)] (greater|more|higher|bigger|larger|above) [than] or (equal to|the same as) %objects%
  • [(neither)] %objects% (was|were)[(n't| not| neither)] ((less|smaller|lower) than|below) %objects%
  • [(neither)] %objects% (was|were)[(n't| not| neither)] (less|smaller|lower|below) [than] or (equal to|the same as) %objects%
  • [(neither)] %objects% ((was|were) (not|neither)|wasn't|weren't) [equal to] %objects%
  • [(neither)] %objects% (was|were) [(equal to|the same as)] %objects%
  • [(neither)] %objects% (was|were) between %objects% and %objects%
  • [(neither)] %objects% (was not|were not|wasn't|weren't) between %objects% and %objects%
  • [(neither)] %objects% (will be|(will (not|neither) be|won't be)) ((greater|more|higher|bigger|larger) than|above) %objects%
  • [(neither)] %objects% (will be|(will (not|neither) be|won't be)) (greater|more|higher|bigger|larger|above) [than] or (equal to|the same as) %objects%
  • [(neither)] %objects% (will be|(will (not|neither) be|won't be)) ((less|smaller|lower) than|below) %objects%
  • [(neither)] %objects% (will be|(will (not|neither) be|won't be)) (less|smaller|lower|below) [than] or (equal to|the same as) %objects%
  • [(neither)] %objects% ((will (not|neither) be|won't be)|(isn't|aren't|is not|are not) (turning|changing) [in]to) [equal to] %objects%
  • [(neither)] %objects% (will be [(equal to|the same as)]|(is|are) (turning|changing) [in]to) %objects%
  • [(neither)] %objects% will be between %objects% and %objects%
  • [(neither)] %objects% (will not be|won't be) between %objects% and %objects%
Since: 1.0
A very general condition, it simply compares two values. Usually you can only compare for equality (e.g. block is/isn't of <type>), but some values can also be compared using greater than/less than. In that case you can also test for whether an object is between two others. Note: This is the only element where not all patterns are shown. It has actually another two sets of similar patters, but with (was|were) or will be instead of (is|are) respectively, which check different time states of the first expression.

Examples:

the clicked block is a stone slab or a double stone slab
time in the player's world is greater than 8:00
the creature is not an enderman or an ender dragon

Exists/Is Set

🔗

Condition

Patterns:
  • %~objects% (exist[s]|(is|are) set)
  • %~objects% (do[es](n't| not) exist|(is|are)(n't| not) set)
Since: 1.2
Checks whether a given expression or variable is set.

Examples:

{teams::%player's uuid%::preferred-team} is not set
on damage:
    projectile exists
    broadcast "%attacker% used a %projectile% to attack %victim%!"

Conditionals

🔗

Section

Patterns:
  • else
  • else [parse] if <.+>
  • else [parse] if (any|at least one [of])
  • else [parse] if [all]
  • [parse] if (any|at least one [of])
  • [parse] if [all]
  • [parse] if <.+>
  • then [run]
  • implicit:<.+>
Since: 1.0
Conditional sections if: executed when its condition is true else if: executed if all previous chained conditionals weren't executed, and its condition is true else: executed if all previous chained conditionals weren't executed

parse if: a special case of 'if' condition that its code will not be parsed if the condition is not true else parse if: another special case of 'else if' condition that its code will not be parsed if all previous chained conditionals weren't executed, and its condition is true

Examples:

if player's health is greater than or equal to 4:
    send "Your health is okay so far but be careful!"

else if player's health is greater than 2:
    send "You need to heal ASAP, your health is very low!"

else: # Less than 2 hearts
    send "You are about to DIE if you don't heal NOW. You have only %player's health% heart(s)!"

parse if plugin "SomePluginName" is enabled: # parse if %condition%
    # This code will only be executed if the condition used is met otherwise Skript will not parse this section therefore will not give any errors/info about this section

Loop

🔗

Section

Patterns:
Since: 1.0
Loop sections repeat their code with multiple values.

A loop will loop through all elements of the given expression, e.g. all players, worlds, items, etc. The conditions & effects inside the loop will be executed for every of those elements, which can be accessed with ‘loop-’, e.g. send "hello" to loop-player. When a condition inside a loop is not fulfilled the loop will start over with the next element of the loop. You can however use stop loop to exit the loop completely and resume code execution after the end of the loop.

Loopable Values All expressions that represent more than one value, e.g. ‘all players’, ‘worlds’, etc., as well as list variables, can be looped. You can also use a list of expressions, e.g. loop the victim and the attacker, to execute the same code for only a few values.

List Variables When looping list variables, you can also use loop-index in addition to loop-value inside the loop. loop-value is the value of the currently looped variable, and loop-index is the last part of the variable's name (the part where the list variable has its asterisk *).

Examples:

loop all players:
    send "Hello %loop-player%!" to loop-player

loop items in player's inventory:
    if loop-item is dirt:
        set loop-item to air

loop 10 times:
    send title "%11 - loop-value%" and subtitle "seconds left until the game begins" to player for 1 second # 10, 9, 8 etc.
    wait 1 second

loop {Coins::*}:
    set {Coins::%loop-index%} to loop-value + 5 # Same as "add 5 to {Coins::%loop-index%}" where loop-index is the uuid of the player and loop-value is the actually coins value such as 200

While Loop

🔗

Section

Patterns:
  • [do] while <.+>
Since: 2.0, 2.6 (do while)
While Loop sections are loops that will just keep repeating as long as a condition is met.

Examples:

while size of all players < 5:
    send "More players are needed to begin the adventure" to all players
    wait 5 seconds

set {_counter} to 1
do while {_counter} > 1: # false but will increase {_counter} by 1 then get out
    add 1 to {_counter}

# Be careful when using while loops with conditions that are almost
# always true for a long time without using 'wait %timespan%' inside it,
# otherwise it will probably hang and crash your server.
while player is online:
    give player 1 dirt
    wait 1 second # without using a delay effect the server will crash

On Skript start/stop

🔗

Event

Patterns:
  • [on] [skript] (start|load|enable|main)
  • [on] [skript] (stop|unload|disable|shutdown)
Since: 2.0
Called when the server starts or stops (actually, when Skript starts or stops, so a /reload will trigger these events as well).

Examples:

on skript start:
on server stop:

AWT Button

🔗

Type

Patterns:
  • set {button} to a new button in {panel}
Since: 3.0
A button widget component.

Examples:

Missing examples.

AWT Check Box

🔗

Type

Patterns:
  • set {check-box} to a new check box in {panel}
Since: 3.0
A check box widget component.

Examples:

Missing examples.

AWT Combo Box

🔗

Type

Patterns:
  • set {combo-box} to a new combo box in {panel}
Since: 3.0
A combo box widget component.

Examples:

Missing examples.

AWT Component

🔗

Type

Patterns:
  • Missing patterns.
Since: 3.0
Any widget component.

Examples:

Missing examples.

AWT Label

🔗

Type

Patterns:
  • set {label} to a new label in {panel}
Since: 3.0
A label widget component.

Examples:

Missing examples.

AWT List

🔗

Type

Patterns:
  • set {list} to a new list in {panel}
Since: 3.0
A list widget component.

Examples:

Missing examples.

AWT Panel

🔗

Type

Patterns:
  • Missing patterns.
Since: 3.0
A panel widget component.

Examples:

set {panel} to a new panel in {window}

AWT Progress Bar

🔗

Type

Patterns:
  • set {progress-bar} to a new progress bar in {panel}
Since: 3.0
A progress bar widget component.

Examples:

Missing examples.

AWT Radio Button

🔗

Type

Patterns:
  • set {radio-button} to a new radio button in {panel}
Since: 3.0
A radio button widget component.

Examples:

Missing examples.

AWT Scroll Pane

🔗

Type

Patterns:
  • set {scroll-pane} to a new scroll pane in {panel}
Since: 3.0
A scroll pane widget component.

Examples:

Missing examples.

AWT Slider

🔗

Type

Patterns:
  • set {slider} to a new slider in {panel}
Since: 3.0
A slider widget component.

Examples:

Missing examples.

AWT Spinner

🔗

Type

Patterns:
  • set {spinner} to a new spinner in {panel}
Since: 3.0
A spinner widget component.

Examples:

Missing examples.

AWT Tabbed Pane

🔗

Type

Patterns:
  • set {tabbed-pane} to a new tabbed pane in {panel}
Since: 3.0
A tabbed pane widget component.

Examples:

Missing examples.

AWT Table

🔗

Type

Patterns:
  • set {table} to a new table in {panel}
Since: 3.0
A table widget component.

Examples:

Missing examples.

AWT Text Area

🔗

Type

Patterns:
  • set {text-area} to a new text area in {panel}
Since: 3.0
A text area widget component.

Examples:

Missing examples.

AWT Text Field

🔗

Type

Patterns:
  • set {text-field} to a new text field in {panel}
Since: 3.0
A text field widget component.

Examples:

Missing examples.

Boolean

🔗

Type

Patterns:
  • true/yes/on or false/no/off
Since: 1.0
A boolean is a value that is either true or false. Other accepted names are 'on' and 'yes' for true, and 'off' and 'no' for false.

Examples:

set {config.%player%.use mod} to false

Color

🔗

Type

Patterns:
  • black, dark grey/dark gray, grey/light grey/gray/light gray/silver, white, blue/dark blue, cyan/aqua/dark cyan/dark aqua, light blue/light cyan/light aqua, green/dark green, light green/lime/lime green, yellow/light yellow, orange/gold/dark yellow, red/dark red, pink/light red, purple/dark purple, magenta/light purple, brown/indigo
Since: Unknown
Wool, dye and chat colors.

Examples:

color of the sheep is red or black
set the color of the block to green
message "You're holding a &amp;lt;%color of tool%&amp;gt;%color of tool%&amp;lt;reset&amp;gt; wool block"

Command Sender

🔗

Type

Patterns:
Since: 1.0
A player or the console.

Examples:

command /push [&amp;amp;lt;player&amp;amp;gt;]:
    trigger:
        if arg-1 is not set:
            if command sender is console:
                send "You can't push yourself as a console :\" to sender
                stop
            push sender upwards with force 2
            send "Yay!"
        else:
            push arg-1 upwards with force 2
            send "Yay!" to sender and arg-1

Date

🔗

Type

Patterns:
  • Missing patterns.
Since: 1.4
A date is a certain point in the real world's time which can be obtained with now expression, unix date expression and date function. See time and timespan for the other time types of Skript.

Examples:

set {_yesterday} to now
subtract a day from {_yesterday}
# now {_yesterday} represents the date 24 hours before now

Number

🔗

Type

Patterns:
  • [-]###[.###] (any amount of digits; very large numbers will be truncated though)
Since: 1.0
A number, e.g. 2.5, 3, or -9812454. Please note that many expressions only need integers, i.e. will discard any fractional parts of any numbers without producing an error.

Examples:

set the player's health to 5.5
set {_temp} to 2*{_temp} - 2.5

Object

🔗

Type

Patterns:
  • Missing patterns.
Since: 1.0
The supertype of all types, meaning that if %object% is used in e.g. a condition it will accept all kinds of expressions.

Examples:

Missing examples.

Text

🔗

Type

Patterns:
  • simple: "..."
  • quotes: "...""..."
  • expressions: "...%expression%..."
  • percent signs: "...%%..."
Since: 1.0
Text is simply text, i.e. a sequence of characters, which can optionally contain expressions which will be replaced with a meaningful representation (e.g. %player% will be replaced with the player's name). Because scripts are also text, you have to put text into double quotes to tell Skript which part of the line is an effect/expression and which part is the text. Please read the article on Texts and Variable Names to learn more.

Examples:

broadcast "Hello World!"
message "Hello %player%"
message "The id of ""%type of tool%"" is %id of tool%."

Time

🔗

Type

Patterns:
  • ##:##
  • ##[:##][ ]am/pm
Since: 1.0
A time is a point in a minecraft day's time (i.e. ranges from 0:00 to 23:59), which can vary per world. See date and timespan for the other time types of Skript.

Examples:

at 20:00:
    time is 8 pm
    broadcast "It's %time%"

Timeperiod

🔗

Type

Patterns:
  • ##:## - ##:##
  • dusk/day/dawn/night
Since: 1.0
A period of time between two times. Mostly useful since you can use this to test for whether it's day, night, dusk or dawn in a specific world. This type might be removed in the future as you can use 'time of world is between x and y' as a replacement.

Examples:

time in world is night

Timespan

🔗

Type

Patterns:
  • <number> [minecraft/mc/real/rl/irl] ticks/seconds/minutes/hours/days/weeks/months/years [[,/and] <more...>]
  • [###:]##:##[.####] ([hours:]minutes:seconds[.milliseconds])
Since: 1.0, 2.6.1 (weeks, months, years)
A timespan is a difference of two different dates or times, e.g '10 minutes'. Timespans are always displayed as real life time, but can be defined as minecraft time, e.g. '5 minecraft days and 12 hours'. NOTE: Months always have the value of 30 days, and years of 365 days. See date and time for the other time types of Skript.

Examples:

every 5 minecraft days:
    wait a minecraft second and 5 ticks
every 10 mc days and 12 hours:
    halt for 12.7 irl minutes, 12 hours and 120.5 seconds

Type

🔗

Type

Patterns:
  • See the type name patterns of all types - including this one
Since: 2.0
Represents a type, e.g. number, object, item type, location, block, world, entity type, etc. This is mostly used for expressions like 'event-<type>', '<type>-argument', 'loop-<type>', etc., e.g. event-world, number-argument and loop-player.

Examples:

{variable} is a number # check whether the variable contains a number, e.g. -1 or 5.5
{variable} is a type # check whether the variable contains a type, e.g. number or player
{variable} is an object # will always succeed if the variable is set as everything is an object, even types.
disable PvP in the event-world
kill the loop-entity

abs

🔗

Function

Patterns:
  • abs(n: number)
Since: 2.2
Return Type: Number
Returns the absolute value of the argument, i.e. makes the argument positive.

Examples:

abs(3) = 3
abs(-2) = 2

acos

🔗

Function

Patterns:
  • acos(n: number)
Since: 2.2
Return Type: Number
The inverse of the cosine, also called arccos. Returns result in degrees, not radians. Only returns values from 0 to 180.

Examples:

acos(0) = 90
acos(1) = 0
acos(0.5) = 30

asin

🔗

Function

Patterns:
  • asin(n: number)
Since: 2.2
Return Type: Number
The inverse of the sine, also called arcsin. Returns result in degrees, not radians. Only returns values from -90 to 90.

Examples:

asin(0) = 0
asin(1) = 90
asin(0.5) = 30

atan

🔗

Function

Patterns:
  • atan(n: number)
Since: 2.2
Return Type: Number
The inverse of the tangent, also called arctan. Returns result in degrees, not radians. Only returns values from -90 to 90.

Examples:

atan(0) = 0
atan(1) = 45
atan(10000) = 89.9943

atan2

🔗

Function

Patterns:
  • atan2(x: number, y: number)
Since: 2.2
Return Type: Number
Similar to atan, but requires two coordinates and returns values from -180 to 180. The returned angle is measured counterclockwise in a standard mathematical coordinate system (x to the right, y to the top).

Examples:

atan2(0, 1) = 0
atan2(10, 0) = 90
atan2(-10, 5) = -63.4349

calcExperience

🔗

Function

Patterns:
  • calcExperience(level: long)
Since: 2.2-dev32
Return Type: long
Calculates the total amount of experience needed to achieve given level from scratch in Minecraft.

Examples:

Missing examples.

ceil

🔗

Function

Patterns:
  • ceil(n: number)
Since: 2.2
Return Type: long
Rounds a number up, i.e. returns the closest integer larger than or equal to the argument.

Examples:

ceil(2.34) = 3
ceil(2) = 2
ceil(2.99) = 3

ceiling

🔗

Function

Patterns:
  • ceiling(n: number)
Since: 2.2
Return Type: long
Alias of ceil.

Examples:

ceiling(2.34) = 3
ceiling(2) = 2
ceiling(2.99) = 3

clamp

🔗

Function

Patterns:
  • clamp(values: numbers, min: number, max: number)
Since: 2.8.0
Return Type: Number
Clamps one or more values between two numbers.

Examples:

clamp(5, 0, 10) = 5
clamp(5.5, 0, 5) = 5
clamp(0.25, 0, 0.5) = 0.25
clamp(5, 7, 10) = 7
clamp((5, 0, 10, 9, 13), 7, 10) = (7, 7, 10, 9, 10)
set {_clamped::*} to clamp({_values::*}, 0, 10)

cos

🔗

Function

Patterns:
  • cos(n: number)
Since: 2.2
Return Type: Number
The cosine function. This is basically the sine shifted by 90°, i.e. cos(a) = sin(a + 90°), for any number a. Uses degrees, not radians.

Examples:

cos(0) = 1
cos(90) = 0

date

🔗

Function

Patterns:
  • date(year: number, month: number, day: number, hour: number = [[integer:0]], minute: number = [[integer:0]], second: number = [[integer:0]], millisecond: number = [[integer:0]], zone_offset: number = [[double:NaN]], dst_offset: number = [[double:NaN]])
Since: 2.2
Return Type: Date
Creates a date from a year, month, and day, and optionally also from hour, minute, second and millisecond. A time zone and DST offset can be specified as well (in minutes), if they are left out the server's time zone and DST offset are used (the created date will not retain this information).

Examples:

date(2014, 10, 1) # 0:00, 1st October 2014
date(1990, 3, 5, 14, 30) # 14:30, 5th May 1990
date(1999, 12, 31, 23, 59, 59, 999, -3*60, 0) # almost year 2000 in parts of Brazil (-3 hours offset, no DST)

exp

🔗

Function

Patterns:
  • exp(n: number)
Since: 2.2
Return Type: Number
The exponential function. You probably don't need this if you don't know what this is.

Examples:

exp(0) = 1
exp(1) = 2.7183

floor

🔗

Function

Patterns:
  • floor(n: number)
Since: 2.2
Return Type: long
Rounds a number down, i.e. returns the closest integer smaller than or equal to the argument.

Examples:

floor(2.34) = 2
floor(2) = 2
floor(2.99) = 2

isNaN

🔗

Function

Patterns:
  • isNaN(n: number)
Since: 2.8.0
Return Type: Boolean
Returns true if the input is NaN (not a number).

Examples:

isNaN(0) # false
isNaN(0/0) # true
isNaN(sqrt(-1)) # true

ln

🔗

Function

Patterns:
  • ln(n: number)
Since: 2.2
Return Type: Number
The natural logarithm. You probably don't need this if you don't know what this is. Returns NaN (not a number) if the argument is negative.

Examples:

ln(1) = 0
ln(exp(5)) = 5
ln(2) = 0.6931

log

🔗

Function

Patterns:
  • log(n: number, base: number = [[integer:10]])
Since: 2.2
Return Type: Number
A logarithm, with base 10 if none is specified. This is the inverse operation to exponentiation (for positive bases only), i.e. log(base ^ exponent, base) = exponent for any positive number 'base' and any number 'exponent'. Another useful equation is base ^ log(a, base) = a for any numbers 'base' and 'a'. Please note that due to how numbers are represented in computers, these equations do not hold for all numbers, as the computed values may slightly differ from the correct value. Returns NaN (not a number) if any of the arguments are negative.

Examples:

log(100) = 2 # 10^2 = 100
log(16, 2) = 4 # 2^4 = 16

max

🔗

Function

Patterns:
  • max(ns: numbers)
Since: 2.2
Return Type: Number
Returns the maximum number from a list of numbers.

Examples:

max(1) = 1
max(1, 2, 3, 4) = 4
max({some list variable::*})

min

🔗

Function

Patterns:
  • min(ns: numbers)
Since: 2.2
Return Type: Number
Returns the minimum number from a list of numbers.

Examples:

min(1) = 1
min(1, 2, 3, 4) = 1
min({some list variable::*})

mod

🔗

Function

Patterns:
  • mod(d: number, m: number)
Since: 2.2
Return Type: Number
Returns the modulo of the given arguments, i.e. the remainder of the division d/m, where d and m are the arguments of this function. The returned value is always positive. Returns NaN (not a number) if the second argument is zero.

Examples:

mod(3, 2) = 1
mod(256436, 100) = 36
mod(-1, 10) = 9

product

🔗

Function

Patterns:
  • product(ns: numbers)
Since: 2.2
Return Type: Number
Calculates the product of a list of numbers.

Examples:

product(1) = 1
product(2, 3, 4) = 24
product({some list variable::*})
product(2, {_v::*}, and the player's y-coordinate)

rgb

🔗

Function

Patterns:
  • rgb(red: long, green: long, blue: long)
Since: 2.5
Return Type: Color
Returns a RGB color from the given red, green and blue parameters.

Examples:

dye player's leggings rgb(120, 30, 45)

round

🔗

Function

Patterns:
  • round(n: number, d: number = [[integer:0]])
Since: 2.2, 2.7 (decimal placement)
Return Type: Number
Rounds a number, i.e. returns the closest integer to the argument. Place a second argument to define the decimal placement.

Examples:

round(2.34) = 2
round(2) = 2
round(2.99) = 3
round(2.5) = 3

sin

🔗

Function

Patterns:
  • sin(n: number)
Since: 2.2
Return Type: Number
The sine function. It starts at 0° with a value of 0, goes to 1 at 90°, back to 0 at 180°, to -1 at 270° and then repeats every 360°. Uses degrees, not radians.

Examples:

sin(90) = 1
sin(60) = 0.866

sqrt

🔗

Function

Patterns:
  • sqrt(n: number)
Since: 2.2
Return Type: Number
The square root, which is the inverse operation to squaring a number (for positive numbers only). This is the same as (argument) ^ (1/2) – other roots can be calculated via number ^ (1/root), e.g. set {_l} to {_volume}^(1/3). Returns NaN (not a number) if the argument is negative.

Examples:

sqrt(4) = 2
sqrt(2) = 1.4142
sqrt(-1) = NaN

sum

🔗

Function

Patterns:
  • sum(ns: numbers)
Since: 2.2
Return Type: Number
Sums a list of numbers.

Examples:

sum(1) = 1
sum(2, 3, 4) = 9
sum({some list variable::*})
sum(2, {_v::*}, and the player's y-coordinate)

tan

🔗

Function

Patterns:
  • tan(n: number)
Since: 2.2
Return Type: Number
The tangent function. This is basically sin(arg)/cos(arg). Uses degrees, not radians.

Examples:

tan(0) = 0
tan(45) = 1
tan(89.99) = 5729.5779