Functions

Built-in functions, called as name(arguments).

abs

  • functions
  • Skript 2.2
abs(n: number)

Returns the absolute value of the argument, i.e. makes the argument positive.

Returns
number
Parameters
In Skript since
2.2
View 2 examples
abs(3) = 3
abs(-2) = 2

acos

  • functions
  • Skript 2.2
acos(n: number)

The inverse of the cosine, also called arccos. Returns result in degrees, not radians. Only returns values from 0 to 180.

Returns
number
Parameters
In Skript since
2.2
View 3 examples
acos(0) = 90
acos(1) = 0
acos(0.5) = 30

asin

  • functions
  • Skript 2.2
asin(n: number)

The inverse of the sine, also called arcsin. Returns result in degrees, not radians. Only returns values from -90 to 90.

Returns
number
Parameters
In Skript since
2.2
View 3 examples
asin(0) = 0
asin(1) = 90
asin(0.5) = 30

atan

  • functions
  • Skript 2.2
atan(n: number)

The inverse of the tangent, also called arctan. Returns result in degrees, not radians. Only returns values from -90 to 90.

Returns
number
Parameters
In Skript since
2.2
View 3 examples
atan(0) = 0
atan(1) = 45
atan(10000) = 89.9943

atan2

  • functions
  • Skript 2.2
atan2(x: number, y: 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).

Returns
number
Parameters
In Skript since
2.2
View 3 examples
atan2(0, 1) = 0
atan2(10, 0) = 90
atan2(-10, 5) = -63.4349

axisAngle

  • functions
  • Skript 2.10
axisAngle(angle: number, axis: vector)

Returns a quaternion from the given angle (in degrees) and axis (as a vector). This represents a rotation around the given axis by the given angle.

Returns
quaternion
Parameters
In Skript since
2.10
View example
axisangle(90, (vector from player's facing))

calcExperience

  • functions
  • Skript 2.2-dev32
calcExperience(level: integer)

Calculates the total amount of experience needed to achieve given level from scratch in Minecraft.

Returns
integer
Parameters
In Skript since
2.2-dev32

case_equals

  • functions
case_equals(strs: texts)

No matching entry in Skript's documentation.

Returns
boolean
Parameters

ceil

  • functions
  • Skript 2.2
ceil(n: number)

Rounds a number up, i.e. returns the closest integer larger than or equal to the argument.

Returns
integer
Parameters
In Skript since
2.2
View 3 examples
ceil(2.34) = 3
ceil(2) = 2
ceil(2.99) = 3

ceiling

  • functions
  • Skript 2.2
ceiling(n: number)

Alias of ceil.

Returns
integer
Parameters
In Skript since
2.2
View 3 examples
ceiling(2.34) = 3
ceiling(2) = 2
ceiling(2.99) = 3

clamp

  • functions
  • Skript 2.8.0
clamp(values: numbers, min: number, max: number)

Clamps one or more values between two numbers.

This function retains indices

Parameters
In Skript since
2.8.0
View 6 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)

combinations

  • functions
  • Skript 2.11
combinations(options: number, selected: number)

Get the number of possible sets from 1 to 'options' with each set having a size equal to 'selected'

For example, a combination with 3 options and a set size of 1, returns 3: (1), (2), (3)

A combination of 3 options with a set size of 2 returns 3: (1, 2), (1, 3), (2, 3)

Note that the bigger the 'options' and lower the 'selected' may result in approximations or even infinity values.

Combinations differ from permutations in that combinations focus on unique sets, ignoring the order of elements, whereas permutations account for the arrangement of elements within the set.

Example: (1, 2) and (2, 1) represent a single combination since order doesn't matter in combinations, but they are two distinct permutations because permutations consider the order.

Returns
number
Parameters
In Skript since
2.11
View 3 examples
combinations(10, 8) = 45
combinations(5, 3) = 10
combinations(size of {some list::*}, 2)

concat

  • functions
  • Skript 2.9.0
concat(texts: objects)

Joins the provided texts (and other things) into a single text.

Returns
text
Parameters
In Skript since
2.9.0
View 2 examples
concat("hello ", "there") # hello there
concat("foo ", 100, " bar") # foo 100 bar

cos

  • functions
  • Skript 2.2
cos(n: 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.

Returns
number
Parameters
In Skript since
2.2
View 2 examples
cos(0) = 1
cos(90) = 0

date

  • functions
  • Skript 2.2
date(year: number, month: number, day: number, hour: number, minute: number, second: number, millisecond: number, zone_offset: number, dst_offset: number)

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).

Returns
date
Parameters
In Skript since
2.2
View 3 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)

entity

  • functions
  • Skript 2.16
entity(uuid: uuid)

Returns an entity from a given UUID.

If the entity is unloaded or an offline player, the function will return nothing.

Returns
entity
Parameters
In Skript since
2.16
View 3 examples
set {_entity} to entity({uuid})
kill entity({uuid})
set {_type} to type of entity({uuid})

exp

  • functions
  • Skript 2.2
exp(n: number)

The exponential function. You probably don't need this if you don't know what this is.

Returns
number
Parameters
In Skript since
2.2
View 2 examples
exp(0) = 1
exp(1) = 2.7183

factorial

  • functions
  • Skript 2.11
factorial(n: number)

Get the factorial of a number.

Getting the factorial of any number above 21 will return an approximation, not an exact value.

Any number after 170 will always return Infinity.

Should not be used to calculate permutations or combinations manually.

Returns
number
Parameters
In Skript since
2.11
View 4 examples
factorial(0) = 1
factorial(3) = 3*2*1 = 6
factorial(5) = 5*4*3*2*1 = 120
factorial(171) = Infinity

floor

  • functions
  • Skript 2.2
floor(n: number)

Rounds a number down, i.e. returns the closest integer smaller than or equal to the argument.

Returns
integer
Parameters
In Skript since
2.2
View 3 examples
floor(2.34) = 2
floor(2) = 2
floor(2.99) = 2

formatNumber

  • functions
  • Skript 2.10
formatNumber(number: number, format: text)

Converts numbers to human-readable format. By default, '###,###' (e.g. '123,456,789') will be used for whole numbers and '###,###.##' (e.g. '123,456,789.00) will be used for decimal numbers. A hashtag '#' represents a digit, a comma ',' is used to separate numbers, and a period '.' is used for decimals.

Will return none if the format is invalid.

For further reference, see this article.

Returns
text
Parameters
In Skript since
2.10
View 6 examples
command /balance:
	aliases: bal
	executable by: players
	trigger:
		set {_money} to formatNumber({money::%sender's uuid%})
		send "Your balance: %{_money}%" to sender

fromBase

  • functions
  • Skript 2.14
fromBase(string: text, base: number)

Turns a text version of a number in a specific base (decimal, hexadecimal, octal) into an actual number.

For example, converting "20" in hexadecimal (base 16) would be 'fromBase("20", 16)', which would return 32.

You can use any base between 2 and 36.

Returns
integer
Parameters
In Skript since
2.14
View example
# /binaryText 01110011 01101011 01110010 01101001 01110000 01110100 00100001
# sends "skript!"
command binaryText <text>:
	trigger:
	set {_characters::*} to argument split at " " without trailing empty string
		transform {_characters::*} with fromBase(input, 2) # convert to codepoints
		transform {_characters::*} with character from codepoint input # convert to characters
		send join {_characters::*}

isNaN

  • functions
  • Skript 2.8.0
isNaN(n: number)

Returns true if the input is NaN (not a number).

Returns
boolean
Parameters
In Skript since
2.8.0
View 3 examples
isNaN(0) # false
isNaN(0/0) # true
isNaN(sqrt(-1)) # true

ln

  • functions
  • Skript 2.2
ln(n: 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.

Returns
number
Parameters
In Skript since
2.2
View 3 examples
ln(1) = 0
ln(exp(5)) = 5
ln(2) = 0.6931

location

  • functions
  • Skript 2.2
location(x: number, y: number, z: number, world: world, yaw: number, pitch: number)

Creates a location from a world and 3 coordinates, with an optional yaw and pitch.

If for whatever reason the world is not found, it will fallback to the server's main world.

Returns
location
Parameters
In Skript since
2.2
View example
# TELEPORTING
teleport player to location(1,1,1, world "world")
teleport player to location(1,1,1, world "world", 100, 0)
teleport player to location(1,1,1, world "world", yaw of player, pitch of player)
teleport player to location(1,1,1, world of player)
teleport player to location(1,1,1, world("world"))
teleport player to location({_x}, {_y}, {_z}, {_w}, {_yaw}, {_pitch})

# SETTING BLOCKS
set block at location(1,1,1, world "world") to stone
set block at location(1,1,1, world "world", 100, 0) to stone
set block at location(1,1,1, world of player) to stone
set block at location(1,1,1, world("world")) to stone
set block at location({_x}, {_y}, {_z}, {_w}) to stone

# USING VARIABLES
set {_l1} to location(1,1,1)
set {_l2} to location(10,10,10)
set blocks within {_l1} and {_l2} to stone
if player is within {_l1} and {_l2}:

# OTHER
kill all entities in radius 50 around location(1,65,1, world "world")
delete all entities in radius 25 around location(50,50,50, world "world_nether")
ignite all entities in radius 25 around location(1,1,1, world of player)

log

  • functions
  • Skript 2.2
log(n: number, base: 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.

Returns
number
Parameters
In Skript since
2.2
View 2 examples
log(100) = 2 # 10^2 = 100
log(16, 2) = 4 # 2^4 = 16

max

  • functions
  • Skript 2.2
max(ns: numbers)

Returns the maximum number from a list of numbers.

Returns
number
Parameters
In Skript since
2.2
View 3 examples
max(1) = 1
max(1, 2, 3, 4) = 4
max({some list variable::*})

mean

  • functions
  • Skript 2.11
mean(ns: numbers)

Get the mean (average) of a list of numbers.

You cannot get the mean of a set of numbers that includes infinity or NaN.

Returns
number
Parameters
In Skript since
2.11
View 3 examples
mean(1, 2, 3) = 2
mean(0, 5, 10) = 5
mean(13, 97, 376, 709) = 298.75

median

  • functions
  • Skript 2.11
median(ns: numbers)

Get the middle value of a sorted list of numbers. If the list has an even number of values, the median is the average of the two middle numbers.

You cannot get the median of a set of numbers that includes NaN.

Returns
number
Parameters
In Skript since
2.11
View 3 examples
median(1, 2, 3, 4, 5) = 3
median(1, 2, 3, 4, 5, 6) = 3.5
median(0, 123, 456, 789) = 289.5

min

  • functions
  • Skript 2.2
min(ns: numbers)

Returns the minimum number from a list of numbers.

Returns
number
Parameters
In Skript since
2.2
View 3 examples
min(1) = 1
min(1, 2, 3, 4) = 1
min({some list variable::*})

mod

  • functions
  • Skript 2.2
mod(d: number, m: 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.

Returns
number
Parameters
In Skript since
2.2
View 3 examples
mod(3, 2) = 1
mod(256436, 100) = 36
mod(-1, 10) = 9

offlineplayer

  • functions
  • Skript 2.8.0, 2.9.0
offlineplayer(nameOrUUID: text, allowLookups: boolean)

Returns a offline player from their name or UUID. This function will still return the player if they're online. If Paper 1.16.5+ is used, the 'allowLookup' parameter can be set to false to prevent this function from doing a web lookup for players who have not joined before. Lookups can cause lag spikes of up to multiple seconds, so use offline players with caution.

Parameters
In Skript since
2.8.0, 2.9.0 (prevent lookups)
View 3 examples
set {_p} to offlineplayer("Notch")
set {_p} to offlineplayer("069a79f4-44e9-4726-a5be-fca90e38aaf5")
set {_p} to offlineplayer("Notch", false)

permutations

  • functions
  • Skript 2.11
permutations(options: number, selected: number)

Get the number of possible ordered arrangements from 1 to 'options' with each arrangement having a size equal to 'selected'

For example, permutations with 3 options and an arrangement size of 1, returns 3: (1), (2), (3)

Permutations with 3 options and an arrangement size of 2 returns 6: (1, 2), (1, 3), (2, 1), (2, 3), (3, 1), (3, 2)

Note that the bigger the 'options' and lower the 'selected' may result in approximations or even infinity values.

Permutations differ from combinations in that permutations account for the arrangement of elements within the set, whereas combinations focus on unique sets and ignore the order of elements.

Example: (1, 2) and (2, 1) are two distinct permutations because the positions of '1' and '2' are different, but they represent a single combination since order doesn't matter in combinations.

Returns
number
Parameters
In Skript since
2.11
View 3 examples
permutations(10, 2) = 90
permutations(10, 4) = 5040
permutations(size of {some list::*}, 2)

player

  • functions
  • Skript 2.8.0
player(nameOrUUID: text, getExactPlayer: boolean)

Returns an online player from their name or UUID, if player is offline function will return nothing.

Setting 'getExactPlayer' parameter to true will return the player whose name is exactly equal to the provided name instead of returning a player that their name starts with the provided name.

Returns
player
Parameters
In Skript since
2.8.0
View 3 examples
set {_p} to player("Notch") # will return an online player whose name is or starts with 'Notch'
set {_p} to player("Notch", true) # will return the only online player whose name is 'Notch'
set {_p} to player("069a79f4-44e9-4726-a5be-fca90e38aaf5") # <none> if player is offline

product

  • functions
  • Skript 2.2
product(ns: numbers)

Calculates the product of a list of numbers.

Returns
number
Parameters
In Skript since
2.2
View 4 examples
product(1) = 1
product(2, 3, 4) = 24
product({some list variable::*})
product(2, {_v::*}, and the player's y-coordinate)

quaternion

  • functions
  • Skript 2.10
quaternion(w: number, x: number, y: number, z: number)

Returns a quaternion from the given W, X, Y and Z parameters.

Returns
quaternion
Parameters
In Skript since
2.10
View example
quaternion(1, 5.6, 45.21, 10)

rgb

  • functions
  • Skript 2.5, 2.10
rgb(red: number, green: number, blue: number, alpha: number)

Returns a RGB color from the given red, green and blue parameters.

Alpha values can be added optionally but these only take affect in certain situations, like text display backgrounds.

Returns
colour
Parameters
In Skript since
2.5, 2.10 (alpha)
View 2 examples
dye player's leggings rgb(120, 30, 45)
set the colour of a text display to rgb(10, 50, 100, 50)

root

  • functions
  • Skript 2.11
root(n: number, x: number)

Calculates the nth root of a number.

Returns
number
Parameters
In Skript since
2.11
View 3 examples
root(2, 4) = 2 # same as sqrt(4)
root(4, 16) = 2
root(-4, 16) = 0.5 # same as 16^(-1/4)

round

  • functions
  • Skript 2.2, 2.7
round(n: number, d: number)

Rounds a number, i.e. returns the closest integer to the argument. Place a second argument to define the decimal placement.

Returns
number
Parameters
In Skript since
2.2, 2.7 (decimal placement)
View 4 examples
round(2.34) = 2
round(2) = 2
round(2.99) = 3
round(2.5) = 3

sin

  • functions
  • Skript 2.2
sin(n: 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.

Returns
number
Parameters
In Skript since
2.2
View 2 examples
sin(90) = 1
sin(60) = 0.866

sqrt

  • functions
  • Skript 2.2
sqrt(n: 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.

Returns
number
Parameters
In Skript since
2.2
View 3 examples
sqrt(4) = 2
sqrt(2) = 1.4142
sqrt(-1) = NaN

sum

  • functions
  • Skript 2.2
sum(ns: numbers)

Sums a list of numbers.

Returns
number
Parameters
In Skript since
2.2
View 4 examples
sum(1) = 1
sum(2, 3, 4) = 9
sum({some list variable::*})
sum(2, {_v::*}, and the player's y-coordinate)

tan

  • functions
  • Skript 2.2
tan(n: number)

The tangent function. This is basically sin(arg)/cos(arg). Uses degrees, not radians.

Returns
number
Parameters
In Skript since
2.2
View 3 examples
tan(0) = 0
tan(45) = 1
tan(89.99) = 5729.5779

toBase

  • functions
  • Skript 2.14
toBase(n: number, base: number)

Turns a number in a string using a specific base (decimal, hexadecimal, octal).

For example, converting 32 to hexadecimal (base 16) would be 'toBase(32, 16)', which would return "20".

You can use any base between 2 and 36.

Returns
text
Parameters
In Skript since
2.14
View example
send "Decode this binary number for a prize! %toBase({_guess}, 2)%"

uuid

  • functions
  • Skript 2.11
uuid(uuid: text)

Returns a UUID from the given string. The string must be in the format of a UUID.

Returns
uuid
Parameters
In Skript since
2.11
View example
uuid("069a79f4-44e9-4726-a5be-fca90e38aaf5")

vector

  • functions
  • Skript 2.15
vector(x: number, y: number, z: number)

Creates a vector from a single argument. Equivalent to vector(n, n, n).

Returns
vector
Parameters
In Skript since
2.15
View example
vector(1) # = vector(1, 1, 1)

world

  • functions
  • Skript 2.2
world(name: text)

Gets a world from its name.

Returns
world
Parameters
In Skript since
2.2
View example
set {_nether} to world("%{_world}%_nether")

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.