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: | 1.0, 2.6.1 (with section), 2.8.6 (dropped items) |
Examples:
spawn a ghast 5 meters above the player
spawn a zombie at the player:
set name of the zombie to ""
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