Patterns: |
|
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
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) |
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 "<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
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) |
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)"
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 |
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!"
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 |
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
halt for 5 minecraft hours
wait a tick
Patterns: |
|
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"
give a diamond to the player if the player has permission "rank.vip"
Patterns: |
|
Since: | 2.4 |
Enables, disables, or reloads a script file.
Examples:
reload script "test"
enable script file "testing"
unload script file "script.sk"
enable script file "testing"
unload script file "script.sk"
Patterns: |
|
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
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 |
Exit the program with or without a custom exit code.
Examples:
on main:
log "Hello World" to the console
exit program
log "Hello World" to the console
exit program
Patterns: |
|
Since: | 2.3 |
Suppresses target warnings from the current script.
Examples:
locally suppress missing conjunction warnings
suppress the variable save warnings
suppress the variable save warnings
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"
log "%player% placed TNT in %world% at %location of block%" to "tnt/placement.log"
Patterns: |
|
Since: | 3.0 |
Writes text to the console.
Examples:
on main:
log "%player% placed TNT in %world% at %location of block%" to the console
log "%player% placed TNT in %world% at %location of block%" to the console