Patterns: |
|
Since: | 2.2, 2.7 (local functions) |
Examples:
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}%}
Patterns: |
|
Since: | 1.0 |
Examples:
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!"
Patterns: |
|
Since: | 1.0 |
Examples:
{joins} = 0
{balance::%player%} = 0
on join:
add 1 to {joins}
message "Your balance is %{balance::%player%}%"
Patterns: |
|
Since: | 2.5 |
Return Type: | Text |
Examples:
trigger:
send "All Scripts: %scripts%" to player
send "Loaded Scripts: %enabled scripts%" to player
send "Unloaded Scripts: %disabled scripts%" to player
Patterns: |
|
Since: | 2.2-dev16 (lowercase and uppercase), 2.5 (advanced cases) |
Return Type: | Text |
Examples:
"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?
Patterns: | |
Since: | 2.8.0 |
Return Type: | Text |
Examples:
broadcast "%loop-value%"
# 0123456789:;<=>?@ABC... ...uvwxyz
send characters between "0" and "z"
# 0123456789ABC... ...uvwxyz
send alphanumeric characters between "0" and "z"
Patterns: | |
Since: | 2.0 |
Return Type: | Text |
Examples:
set message to colored message # Safe; only colors get parsed
command /fade <player>:
trigger:
set display name of the player-argument to uncolored display name of the player-argument
command /format <text>:
trigger:
message formatted text-argument # Safe, because we're sending to whoever used this command
Patterns: | |
Since: | 2.2-dev33 |
Return Type: | Date |
Examples:
set {_hourAfter} to 1 hour after {someOtherDate}
set {_hoursBefore} to 5 hours before {someOtherDate}
Patterns: |
|
Since: | 2.0, 2.2-dev32 (SHA-256 algorithm) |
Return Type: | Text |
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:
trigger:
set {password::%uuid of player%} to text-argument hashed with SHA-256
command /login <text>:
trigger:
if text-argument hashed with SHA-256 is {password::%uuid of player%}:
message "Login successful."
else:
message "Wrong password!"
Patterns: | |
Since: | 2.1 |
Return Type: | long |
Examples:
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}
Patterns: | |
Since: | 2.4 (indices), 2.6.1 (sorting) |
Return Type: | Text |
Examples:
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
Patterns: |
|
Since: | 2.7 |
Return Type: | Text |
Examples:
broadcast "This server uses Vault plugin!"
send "Plugins (%size of loaded plugins%): %plugins%" to player
Patterns: |
|
Since: | 2.8.0 |
Return Type: | long |
Examples:
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%"
Patterns: |
|
Since: | 1.0, 2.8.0 (loop-counter) |
Return Type: | Object |
Examples:
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%"
Patterns: |
|
Since: | 1.4 |
Return Type: | Date |
Examples:
Patterns: | |
Since: | 2.5 |
Return Type: | long |
Examples:
on chat:
if number of uppercase chars in message / length of message > 0.5
cancel event
send "<red>Your message has to many caps!" to player
Patterns: | |
Since: | 1.4.6 (integers & numbers), 2.5.1 (decimals) |
Return Type: | Number |
Examples:
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
Patterns: | |
Since: | 2.0 |
Return Type: | Object |
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:
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
Patterns: |
|
Since: | 2.0 |
Return Type: | Text |
Examples:
if {var} is not set:
parse error is set:
message "<red>Line 1 is invalid: %last parse error%"
else:
message "<red>Please put an integer on line 1!"
Patterns: | |
Since: | 2.8.0 |
Return Type: | Number |
Examples:
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
Patterns: | |
Since: | 2.8.0 |
Return Type: | Text |
Examples:
send 3 random alphanumeric characters between "0" and "z"
Patterns: | |
Since: | 1.4 |
Return Type: | Number |
random number between 2 and 1
will work as well as random number between 1 and 2
. Examples:
send "You rolled a %random integer from 1 to 6%!" to the player
Patterns: |
|
Since: | 2.5.1 |
Return Type: | Text |
Examples:
Patterns: | |
Since: | 2.0 |
Return Type: | long |
Examples:
set line 1 of the block to rounded "%(1.5 * player's level)%"
add rounded down argument to the player's health
Patterns: |
|
Since: | 2.0 |
Usable in events: | Script Load/Unload |
Return Type: | Text |
Examples:
set {running::%script%} to true
on script unload:
set {running::%script%} to false
Patterns: |
|
Since: | 2.1, 2.5.2 (character at, multiple strings support) |
Return Type: | Text |
Examples:
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
Patterns: | |
Since: | 2.7 |
Return Type: | Object |
Examples:
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"
Patterns: |
|
Since: | 1.0 |
Examples:
victim is a player
victim has the permission "skript.god"
cancel the event
Patterns: | |
Since: | 1.0 (set, add, remove, delete), 2.0 (remove all) |
Examples:
Set the player's display name to "<red>%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
Patterns: |
|
Since: | 2.2-dev37, 2.7 (while loops), 2.8.0 (outer loops) |
Examples:
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)"
Patterns: | |
Since: | 2.8.0 |
Examples:
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!"
Patterns: |
|
Since: | 1.4 |
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:
halt for 5 minecraft hours
wait a tick
Patterns: |
|
Since: | 2.3 |
Examples:
give a diamond to the player if the player has permission "rank.vip"
Patterns: |
|
Since: | 2.4 |
Examples:
enable script file "testing"
unload script file "script.sk"
Patterns: |
|
Since: | unknown (before 2.1) |
Examples:
stop
message "%player% has no ores!"
loop blocks above the player:
loop-block is not air:
exit 2 sections
set loop-block to water
Patterns: |
|
Since: | 3.0 |
Examples:
log "Hello World" to the console
exit program
Patterns: |
|
Since: | 2.3 |
Examples:
suppress the variable save warnings
Patterns: | |
Since: | 2.0 |
Examples:
log "%player% placed TNT in %world% at %location of block%" to "tnt/placement.log"
Patterns: |
|
Since: | 3.0 |
Examples:
log "%player% placed TNT in %world% at %location of block%" to the console
Patterns: |
|
Since: | 2.2, 2.8.0 (returns aliases) |
Examples:
return 2 * {_i}
function divide(i: number) returns number:
return {_i} / 2
Patterns: |
|
Since: | 1.0 |
(was|were)
or will be
instead of (is|are)
respectively, which check different time states of the first expression. Examples:
time in the player's world is greater than 8:00
the creature is not an enderman or an ender dragon
Patterns: | |
Since: | 1.2 |
Examples:
on damage:
projectile exists
broadcast "%attacker% used a %projectile% to attack %victim%!"
Patterns: |
|
Since: | 1.0 |
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:
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
Patterns: |
|
Since: | 1.0 |
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- 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. List Variables When looping list variables, you can also use 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.loop the victim and the attacker
, to execute the same code for only a few values.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:
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
Patterns: |
|
Since: | 2.0, 2.6 (do while) |
Examples:
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
Patterns: |
|
Since: | 2.0 |
Examples:
on server stop:
Patterns: |
|
Since: | 3.0 |
Examples:
Patterns: |
|
Since: | 3.0 |
Examples:
Patterns: |
|
Since: | 3.0 |
Examples:
Patterns: |
|
Since: | 3.0 |
Examples:
Patterns: |
|
Since: | 3.0 |
Examples:
Patterns: |
|
Since: | 3.0 |
Examples:
Patterns: |
|
Since: | 3.0 |
Examples:
Patterns: |
|
Since: | 3.0 |
Examples:
Patterns: |
|
Since: | 3.0 |
Examples:
Patterns: |
|
Since: | 3.0 |
Examples:
Patterns: |
|
Since: | 3.0 |
Examples:
Patterns: |
|
Since: | 3.0 |
Examples:
Patterns: |
|
Since: | 3.0 |
Examples:
Patterns: |
|
Since: | 3.0 |
Examples:
Patterns: |
|
Since: | 3.0 |
Examples:
Patterns: |
|
Since: | 3.0 |
Examples:
Patterns: |
|
Since: | 1.0 |
Examples:
Patterns: |
|
Since: | Unknown |
Examples:
set the color of the block to green
message "You're holding a &lt;%color of tool%&gt;%color of tool%&lt;reset&gt; wool block"
Patterns: |
|
Since: | 1.0 |
Examples:
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
Patterns: |
|
Since: | 1.4 |
Examples:
subtract a day from {_yesterday}
# now {_yesterday} represents the date 24 hours before now
Patterns: |
|
Since: | 1.0 |
Examples:
set {_temp} to 2*{_temp} - 2.5
Patterns: |
|
Since: | 1.0 |
Examples:
Patterns: |
|
Since: | 1.0 |
Examples:
message "Hello %player%"
message "The id of ""%type of tool%"" is %id of tool%."
Patterns: |
|
Since: | 1.0 |
Examples:
Patterns: |
|
Since: | 1.0, 2.6.1 (weeks, months, years) |
Examples:
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
Patterns: |
|
Since: | 2.0 |
Examples:
{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
Patterns: |
|
Since: | 2.2 |
Return Type: | Number |
Examples:
abs(-2) = 2
Patterns: |
|
Since: | 2.2 |
Return Type: | Number |
Examples:
atan2(10, 0) = 90
atan2(-10, 5) = -63.4349
Patterns: |
|
Since: | 2.2-dev32 |
Return Type: | long |
Examples:
Patterns: |
|
Since: | 2.2 |
Return Type: | long |
Examples:
ceil(2) = 2
ceil(2.99) = 3
Patterns: |
|
Since: | 2.8.0 |
Return Type: | Number |
Examples:
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)
Patterns: |
|
Since: | 2.2 |
Return Type: | Date |
Examples:
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)
Patterns: |
|
Since: | 2.2 |
Return Type: | Number |
Examples:
exp(1) = 2.7183
Patterns: |
|
Since: | 2.2 |
Return Type: | long |
Examples:
floor(2) = 2
floor(2.99) = 2
Patterns: |
|
Since: | 2.8.0 |
Return Type: | Boolean |
Examples:
isNaN(0/0) # true
isNaN(sqrt(-1)) # true
Patterns: |
|
Since: | 2.2 |
Return Type: | Number |
Examples:
ln(exp(5)) = 5
ln(2) = 0.6931
Patterns: |
|
Since: | 2.2 |
Return Type: | Number |
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(16, 2) = 4 # 2^4 = 16
Patterns: |
|
Since: | 2.2 |
Return Type: | Number |
Examples:
max(1, 2, 3, 4) = 4
max({some list variable::*})
Patterns: |
|
Since: | 2.2 |
Return Type: | Number |
Examples:
min(1, 2, 3, 4) = 1
min({some list variable::*})
Patterns: |
|
Since: | 2.2 |
Return Type: | Number |
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(256436, 100) = 36
mod(-1, 10) = 9
Patterns: |
|
Since: | 2.2 |
Return Type: | Number |
Examples:
product(2, 3, 4) = 24
product({some list variable::*})
product(2, {_v::*}, and the player's y-coordinate)
Patterns: |
|
Since: | 2.5 |
Return Type: | Color |
Examples:
Patterns: |
|
Since: | 2.2, 2.7 (decimal placement) |
Return Type: | Number |
Examples:
round(2) = 2
round(2.99) = 3
round(2.5) = 3
Patterns: |
|
Since: | 2.2 |
Return Type: | Number |
Examples:
sin(60) = 0.866
Patterns: |
|
Since: | 2.2 |
Return Type: | Number |
(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(2) = 1.4142
sqrt(-1) = NaN
Patterns: |
|
Since: | 2.2 |
Return Type: | Number |
Examples:
sum(2, 3, 4) = 9
sum({some list variable::*})
sum(2, {_v::*}, and the player's y-coordinate)