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).
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.2 |
Return Type: |
Alias of ceil.
Examples:
ceiling(2.34) = 3
ceiling(2) = 2
ceiling(2.99) = 3
ceiling(2) = 2
ceiling(2.99) = 3
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).
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.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.
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.
Examples:
location(0, 128, 0)
location(player's x-coordinate, player's y-coordinate + 5, player's z-coordinate, player's world, 0, 90)
location(0, 64, 0, world "world_nether")
location(100, 110, -145, world("my_custom_world"))
location(player's x-coordinate, player's y-coordinate + 5, player's z-coordinate, player's world, 0, 90)
location(0, 64, 0, world "world_nether")
location(100, 110, -145, world("my_custom_world"))
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.
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.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
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.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.5 |
Return Type: | color |
Returns a RGB color from the given red, green and blue parameters.
Examples:
dye player's leggings rgb(120, 30, 45)
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
(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.2-dev23 |
Return Type: | vector |
Creates a new vector, which can be used with various expressions, effects and functions.
Examples:
vector(0, 0, 0)