Sections

Lines ending in a colon with code under them.

Catch Runtime Errors

  • sections
  • Skript 2.12
catch [run[ ]time] error[s]

Catch any runtime errors produced by code within the section. This is an in progress feature.

In Skript since
2.12
ID
SecCatchErrors
View example
catch runtime errors:
	set worldborder center of {_border} to location(0, 0, NaN value)
if last caught runtime errors contains "Your location can't have a NaN value as one of its components":
	set worldborder center of {_border} to location(0, 0, 0)

Conditionals

  • sections
  • Skript 1.0
elseelse [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]<.+>

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

In Skript since
1.0
ID
SecConditional
View 2 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

Filter

  • sections
  • Skript 2.10
filter %objects% to match [any|all]

Filters a variable list based on the supplied conditions. Unlike the filter expression, this effect maintains the indices of the filtered list.

It also supports filtering based on meeting any of the given criteria, rather than all, like multi-line if statements.

In Skript since
2.10
ID
SecFilter
View 2 examples
set {_a::*} to integers between -10 and 10
filter {_a::*} to match:
	input is a number
	mod(input, 2) = 0
	input > 0
send {_a::*} # sends 2, 4, 6, 8, and 10

For Each Loop

  • sections
  • Skript 2.10, 2.14
(for [each]|loop) [value] %object% in %objects%(for [each]|loop) (key|index) %object% in %objects%(for [each]|loop) [key|index] %object%(,| and) [value] %object% in %objects%

A specialised loop section run for each element in a list.

Unlike the basic loop, this is designed for extracting the key & value from pairs.

The loop element's key/index and value can be stored in a variable for convenience.

When looping a simple (non-indexed) set of values, e.g. all players, the index will be the loop counter number.

In Skript since
2.10, 2.14 (stable release)
ID
SecFor
View 5 examples
for each {_player} in players:
	send "Hello %{_player}%!" to {_player}
loop {_item} in {list of items::*}:
	broadcast {_item}'s name
for each key {_index} in {list of items::*}:
	broadcast {_index}
loop key {_index} and value {_value} in {list of items::*}:
	broadcast "%{_index}% = %{_value}%"
for each {_index}, {_value} in {my list::*}:
	broadcast "%{_index}% = %{_value}%"

Locally Suppress Warning

  • sections
  • Skript 2.3
[local[ly]] [un]suppress [the] (conflict|variable save|[missing] conjunction|starting [with] expression[s]|variable[ name][s] contain[s|ing] colon[s]|deprecated syntax|unreachable code|constant condition[s]) warning[s][start|stop] [local[ly]] suppressing [the] (conflict|variable save|[missing] conjunction|starting [with] expression[s]|variable[ name][s] contain[s|ing] colon[s]|deprecated syntax|unreachable code|constant condition[s]) warning[s]

Suppresses target warnings from the current script.

In Skript since
2.3, 2.17 (suppressing in a section)
ID
EffSecSuppressWarnings
View 2 examples
locally suppress missing conjunction warnings
suppress the variable save warnings

Loop

  • sections
  • Skript 1.0
loop %objects%

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-<what>’, 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 *).

In Skript since
1.0
ID
SecLoop
View 5 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 number of coins for the player
loop shuffled (integers between 0 and 8):
	if all:
		previous loop-value = 1
		loop-value = 4
		next loop-value = 8
	then:
		kill all players

Run On

  • sections
run on %entity/location%

No matching entry in Skript's documentation.

ID
SecRunOn

Shoot

  • sections
  • Skript 2.10
shoot %entity types% [from %living entities/locations%] [(at|with) (speed|velocity) %number%] [%direction%](make|let) %living entities/locations% shoot %entity types% [(at|with) (speed|velocity) %number%] [%direction%]

Shoots a projectile (or any other entity) from a given entity or location.

In Skript since
2.10
ID
EffSecShoot
View 2 examples
shoot arrow from all players at speed 2
shoot a pig from all players:
	add event-entity to {_projectiles::*}

Spawn

  • sections
  • Skript 1.0, 2.6.1
(spawn|summon) %entity types/entity snapshots% [%directions% %locations%](spawn|summon) %number% of %entity types/entity snapshots% [%directions% %locations%](spawn|summon) %number% %entity types% [%directions% %locations%](spawn|summon) %experience% [%directions% %locations%]

Spawns entities. This can be used as an effect and as a section.

If it is used as a section, the section is run before the entity is added to the world.

You can modify the entity in this section, using for example 'event-entity' or 'cow'.

Do note that other event values, such as 'player', won't work in this section.

If you're spawning a display and want it to be empty on initialization, like not having a block display be stone, set hidden config node 'spawn empty displays' to true.

Note that when spawning an entity via entity snapshots, the code within the section will not run instantaneously as compared to spawning normally (via 'a zombie').

Requires
Minecraft 1.20.2+ (entity snapshots)
In Skript since
1.0, 2.6.1 (with section), 2.8.6 (dropped items), 2.10 (entity snapshots)
ID
EffSecSpawn
View 4 examples
spawn 3 creepers at the targeted block
spawn a ghast 5 meters above the player
spawn a zombie at the player:
	set name of the zombie to ""
spawn a block display of a ladder[waterlogged=true] at location above player:
	set billboard of event-display to center # allows the display to rotate around the center axis

Suppress Type Hints (Experimental)

  • sections
  • Skript 2.12
[un]suppress [local variable] type hints(start|stop) suppressing [local variable] type hints

An effect to suppress local variable type hint errors for the syntax lines that follow this effect.

NOTE: Suppressing type hints also prevents syntax from providing new type hints. For example, with type hints suppressed, 'set {_x} to true' would not provide 'boolean' as a type hint for '{_x}'

In Skript since
2.12, 2.17 (suppressing in a section)
ID
EffSecSuppressTypeHints
View example
start suppressing local variable type hints
# potentially unsafe code goes here
stop suppressing local variable type hints

While Loop

  • sections
  • Skript 2.0, 2.6
[do] while <.+>

While Loop sections are loops that will just keep repeating as long as a condition is met.

In Skript since
2.0, 2.6 (do while)
ID
SecWhile
View 3 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

Generated from NeoSkript 0.1.0-SNAPSHOT's registry on Paper 26.3. Descriptions and examples from Skript's documentation (Skript 2.17.0), GPL-3.0. 1172 of 1205 entries matched one of its entries by id, event name or pattern; the rest show only their patterns.