Note:
These functions are defined by Skript. You may also create your own functions! Tutorial for doing so is planned, but right now you need to seek it elsewhere.
Patterns: |
|
Since: | 2.2 |
Return Type: | Number |
Returns the absolute value of the argument, i.e. makes the argument positive.
Examples:
abs(3) = 3
abs(-2) = 2
abs(-2) = 2
Patterns: |
|
Since: | 2.2 |
Return Type: | 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).
The returned angle is measured counterclockwise in a standard mathematical coordinate system (x to the right, y to the top).
Examples:
atan2(0, 1) = 0
atan2(10, 0) = 90
atan2(-10, 5) = -63.4349
atan2(10, 0) = 90
atan2(-10, 5) = -63.4349
Patterns: |
|
Since: | 2.10 |
Return Type: | Quaternion |
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.
Examples:
axisangle(90, (vector from player's facing))
Patterns: |
|
Since: | 2.2-dev32 |
Return Type: | long |
Calculates the total amount of experience needed to achieve given level from scratch in Minecraft.
Examples:
Missing examples.
Patterns: |
|
Since: | 2.2 |
Return Type: | long |
Rounds a number up, i.e. returns the closest integer larger than or equal to the argument.
Examples:
ceil(2.34) = 3
ceil(2) = 2
ceil(2.99) = 3
ceil(2) = 2
ceil(2.99) = 3
Patterns: |
|
Since: | 2.8.0 |
Return Type: | Number |
Clamps one or more values between two numbers.
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)
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.11 |
Return Type: | 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.
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.
Examples:
combinations(10, 8) = 45
combinations(5, 3) = 10
combinations(size of {some list::*}, 2)
combinations(5, 3) = 10
combinations(size of {some list::*}, 2)
Patterns: |
|
Since: | 2.9.0 |
Return Type: | Text |
Joins the provided texts (and other things) into a single text.
Examples:
concat("hello ", "there") # hello there
concat("foo ", 100, " bar") # foo 100 bar
concat("foo ", 100, " bar") # foo 100 bar
Patterns: |
|
Since: | 2.2 |
Return Type: | Date |
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).
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).
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)
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 |
The exponential function. You probably don't need this if you don't know what this is.
Examples:
exp(0) = 1
exp(1) = 2.7183
exp(1) = 2.7183
Patterns: |
|
Since: | 2.11 |
Return Type: | 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.
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.
Examples:
factorial(0) = 1
factorial(3) = 3*2*1 = 6
factorial(5) = 5*4*3*2*1 = 120
factorial(171) = Infinity
factorial(3) = 3*2*1 = 6
factorial(5) = 5*4*3*2*1 = 120
factorial(171) = Infinity
Patterns: |
|
Since: | 2.2 |
Return Type: | long |
Rounds a number down, i.e. returns the closest integer smaller than or equal to the argument.
Examples:
floor(2.34) = 2
floor(2) = 2
floor(2.99) = 2
floor(2) = 2
floor(2.99) = 2
Patterns: |
|
Since: | 2.10 |
Return Type: | 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.
Will return none if the format is invalid.
For further reference, see this article.
Examples:
command /balance:
aliases: bal
executable by: players
trigger:
set {_money} to formatNumber({money::%sender's uuid%})
send "Your balance: %{_money}%" to sender
aliases: bal
executable by: players
trigger:
set {_money} to formatNumber({money::%sender's uuid%})
send "Your balance: %{_money}%" to sender
Patterns: |
|
Since: | 2.8.0 |
Return Type: | Boolean |
Returns true if the input is NaN (not a number).
Examples:
isNaN(0) # false
isNaN(0/0) # true
isNaN(sqrt(-1)) # true
isNaN(0/0) # true
isNaN(sqrt(-1)) # true
Patterns: |
|
Since: | 2.2 |
Return Type: | 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 NaN (not a number) if the argument is negative.
Examples:
ln(1) = 0
ln(exp(5)) = 5
ln(2) = 0.6931
ln(exp(5)) = 5
ln(2) = 0.6931
Patterns: |
|
Since: | 2.2 |
Return Type: | Location |
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.
If for whatever reason the world is not found, it will fallback to the server's main world.
Examples:
# 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)
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)
Patterns: |
|
Since: | 2.2 |
Return Type: | Number |
A logarithm, with base 10 if none is specified. This is the inverse operation to exponentiation (for positive bases only), i.e.
Another useful equation is
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.
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(100) = 2 # 10^2 = 100
log(16, 2) = 4 # 2^4 = 16
log(16, 2) = 4 # 2^4 = 16
Patterns: |
|
Since: | 2.2 |
Return Type: | Number |
Returns the maximum number from a list of numbers.
Examples:
max(1) = 1
max(1, 2, 3, 4) = 4
max({some list variable::*})
max(1, 2, 3, 4) = 4
max({some list variable::*})
Patterns: |
|
Since: | 2.11 |
Return Type: | Number |
Get the mean (average) of a list of numbers.
You cannot get the mean of a set of numbers that includes infinity or NaN.
You cannot get the mean of a set of numbers that includes infinity or NaN.
Examples:
mean(1, 2, 3) = 2
mean(0, 5, 10) = 5
mean(13, 97, 376, 709) = 298.75
mean(0, 5, 10) = 5
mean(13, 97, 376, 709) = 298.75
Patterns: |
|
Since: | 2.11 |
Return Type: | Number |
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.
You cannot get the median of a set of numbers that includes NaN.
Examples:
median(1, 2, 3, 4, 5) = 3
median(1, 2, 3, 4, 5, 6) = 3.5
median(0, 123, 456, 789) = 289.5
median(1, 2, 3, 4, 5, 6) = 3.5
median(0, 123, 456, 789) = 289.5
Patterns: |
|
Since: | 2.2 |
Return Type: | Number |
Returns the minimum number from a list of numbers.
Examples:
min(1) = 1
min(1, 2, 3, 4) = 1
min({some list variable::*})
min(1, 2, 3, 4) = 1
min({some list variable::*})
Patterns: |
|
Since: | 2.2 |
Return Type: | Number |
Returns the modulo of the given arguments, i.e. the remainder of the division
The returned value is always positive. Returns NaN (not a number) if the second argument is zero.
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(3, 2) = 1
mod(256436, 100) = 36
mod(-1, 10) = 9
mod(256436, 100) = 36
mod(-1, 10) = 9
Patterns: |
|
Since: | 2.8.0, 2.9.0 (prevent lookups) |
Return Type: | Offline Player |
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.
Examples:
set {_p} to offlineplayer("Notch")
set {_p} to offlineplayer("069a79f4-44e9-4726-a5be-fca90e38aaf5")
set {_p} to offlineplayer("Notch", false)
set {_p} to offlineplayer("069a79f4-44e9-4726-a5be-fca90e38aaf5")
set {_p} to offlineplayer("Notch", false)
Patterns: |
|
Since: | 2.11 |
Return Type: | 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.
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.
Examples:
permutations(10, 2) = 90
permutations(10, 4) = 5040
permutations(size of {some list::*}, 2)
permutations(10, 4) = 5040
permutations(size of {some list::*}, 2)
Patterns: |
|
Since: | 2.8.0 |
Return Type: | Player |
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.
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.
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
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
Patterns: |
|
Since: | 2.2 |
Return Type: | Number |
Calculates the product of a list of numbers.
Examples:
product(1) = 1
product(2, 3, 4) = 24
product({some list variable::*})
product(2, {_v::*}, and the player's y-coordinate)
product(2, 3, 4) = 24
product({some list variable::*})
product(2, {_v::*}, and the player's y-coordinate)
Patterns: |
|
Since: | 2.10 |
Return Type: | Quaternion |
Returns a quaternion from the given W, X, Y and Z parameters.
Examples:
quaternion(1, 5.6, 45.21, 10)
Patterns: |
|
Since: | 2.5, 2.10 (alpha) |
Return Type: | Color |
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.
Examples:
dye player's leggings rgb(120, 30, 45)
set the colour of a text display to rgb(10, 50, 100, 50)
set the colour of a text display to rgb(10, 50, 100, 50)
Patterns: |
|
Since: | 2.11 |
Return Type: | Number |
Calculates the nth root of a number.
Examples:
root(2, 4) = 2 # same as sqrt(4)
root(4, 16) = 2
root(-4, 16) = 0.5 # same as 16^(-1/4)
root(4, 16) = 2
root(-4, 16) = 0.5 # same as 16^(-1/4)
Patterns: |
|
Since: | 2.2, 2.7 (decimal placement) |
Return Type: | Number |
Rounds a number, i.e. returns the closest integer to the argument. Place a second argument to define the decimal placement.
Examples:
round(2.34) = 2
round(2) = 2
round(2.99) = 3
round(2.5) = 3
round(2) = 2
round(2.99) = 3
round(2.5) = 3
Patterns: |
|
Since: | 2.2 |
Return Type: | 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.
Examples:
sin(90) = 1
sin(60) = 0.866
sin(60) = 0.866
Patterns: |
|
Since: | 2.2 |
Return Type: | Number |
The square root, which is the inverse operation to squaring a number (for positive numbers only). This is the same as
Returns NaN (not a number) if the argument is negative.
(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(4) = 2
sqrt(2) = 1.4142
sqrt(-1) = NaN
sqrt(2) = 1.4142
sqrt(-1) = NaN
Patterns: |
|
Since: | 2.2 |
Return Type: | Number |
Sums a list of numbers.
Examples:
sum(1) = 1
sum(2, 3, 4) = 9
sum({some list variable::*})
sum(2, {_v::*}, and the player's y-coordinate)
sum(2, 3, 4) = 9
sum({some list variable::*})
sum(2, {_v::*}, and the player's y-coordinate)
Patterns: |
|
Since: | 2.11 |
Return Type: | UUID |
Returns a UUID from the given string. The string must be in the format of a UUID.
Examples:
uuid("069a79f4-44e9-4726-a5be-fca90e38aaf5")
Patterns: |
|
Since: | 2.2-dev23 |
Return Type: | Vector |
Creates a new vector, which can be used with various expressions, effects and functions.
Examples:
vector(0, 0, 0)