abs
- functions
- Skript 2.2
abs(n: number)Returns the absolute value of the argument, i.e. makes the argument positive.
View 2 examples
abs(3) = 3abs(-2) = 246 functions
Built-in functions, called as name(arguments).
abs(n: number)Returns the absolute value of the argument, i.e. makes the argument positive.
abs(3) = 3abs(-2) = 2acos(n: number)The inverse of the cosine, also called arccos. Returns result in degrees, not radians. Only returns values from 0 to 180.
acos(0) = 90acos(1) = 0acos(0.5) = 30asin(n: number)The inverse of the sine, also called arcsin. Returns result in degrees, not radians. Only returns values from -90 to 90.
asin(0) = 0asin(1) = 90asin(0.5) = 30atan(n: number)The inverse of the tangent, also called arctan. Returns result in degrees, not radians. Only returns values from -90 to 90.
atan(0) = 0atan(1) = 45atan(10000) = 89.9943atan2(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).
atan2(0, 1) = 0atan2(10, 0) = 90atan2(-10, 5) = -63.4349axisAngle(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.
axisangle(90, (vector from player's facing))calcExperience(level: integer)Calculates the total amount of experience needed to achieve given level from scratch in Minecraft.
case_equals(strs: texts)No matching entry in Skript's documentation.
ceil(n: number)Rounds a number up, i.e. returns the closest integer larger than or equal to the argument.
ceil(2.34) = 3ceil(2) = 2ceil(2.99) = 3ceiling(n: number)Alias of ceil.
ceiling(2.34) = 3ceiling(2) = 2ceiling(2.99) = 3clamp(values: numbers, min: number, max: number)Clamps one or more values between two numbers.
This function retains indices
clamp(5, 0, 10) = 5clamp(5.5, 0, 5) = 5clamp(0.25, 0, 0.5) = 0.25clamp(5, 7, 10) = 7clamp((5, 0, 10, 9, 13), 7, 10) = (7, 7, 10, 9, 10)set {_clamped::*} to clamp({_values::*}, 0, 10)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.
combinations(10, 8) = 45combinations(5, 3) = 10combinations(size of {some list::*}, 2)concat(texts: objects)Joins the provided texts (and other things) into a single text.
concat("hello ", "there") # hello thereconcat("foo ", 100, " bar") # foo 100 barcos(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.
cos(0) = 1cos(90) = 0date(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).
date(2014, 10, 1) # 0:00, 1st October 2014date(1990, 3, 5, 14, 30) # 14:30, 5th May 1990date(1999, 12, 31, 23, 59, 59, 999, -3*60, 0) # almost year 2000 in parts of Brazil (-3 hours offset, no DST)entity(uuid: uuid)Returns an entity from a given UUID.
If the entity is unloaded or an offline player, the function will return nothing.
set {_entity} to entity({uuid})kill entity({uuid})set {_type} to type of entity({uuid})exp(n: number)The exponential function. You probably don't need this if you don't know what this is.
exp(0) = 1exp(1) = 2.7183factorial(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.
factorial(0) = 1factorial(3) = 3*2*1 = 6factorial(5) = 5*4*3*2*1 = 120factorial(171) = Infinityfloor(n: number)Rounds a number down, i.e. returns the closest integer smaller than or equal to the argument.
floor(2.34) = 2floor(2) = 2floor(2.99) = 2formatNumber(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.
command /balance: aliases: bal executable by: players trigger: set {_money} to formatNumber({money::%sender's uuid%}) send "Your balance: %{_money}%" to senderfromBase(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.
# /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(n: number)Returns true if the input is NaN (not a number).
isNaN(0) # falseisNaN(0/0) # trueisNaN(sqrt(-1)) # trueln(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.
ln(1) = 0ln(exp(5)) = 5ln(2) = 0.6931location(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.
# 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(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.
log(100) = 2 # 10^2 = 100log(16, 2) = 4 # 2^4 = 16max(ns: numbers)Returns the maximum number from a list of numbers.
max(1) = 1max(1, 2, 3, 4) = 4max({some list variable::*})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.
mean(1, 2, 3) = 2mean(0, 5, 10) = 5mean(13, 97, 376, 709) = 298.75median(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.
median(1, 2, 3, 4, 5) = 3median(1, 2, 3, 4, 5, 6) = 3.5median(0, 123, 456, 789) = 289.5min(ns: numbers)Returns the minimum number from a list of numbers.
min(1) = 1min(1, 2, 3, 4) = 1min({some list variable::*})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.
mod(3, 2) = 1mod(256436, 100) = 36mod(-1, 10) = 9offlineplayer(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.
set {_p} to offlineplayer("Notch")set {_p} to offlineplayer("069a79f4-44e9-4726-a5be-fca90e38aaf5")set {_p} to offlineplayer("Notch", false)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.
permutations(10, 2) = 90permutations(10, 4) = 5040permutations(size of {some list::*}, 2)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.
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 offlineproduct(ns: numbers)Calculates the product of a list of numbers.
product(1) = 1product(2, 3, 4) = 24product({some list variable::*})product(2, {_v::*}, and the player's y-coordinate)quaternion(w: number, x: number, y: number, z: number)Returns a quaternion from the given W, X, Y and Z parameters.
quaternion(1, 5.6, 45.21, 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.
dye player's leggings rgb(120, 30, 45)set the colour of a text display to rgb(10, 50, 100, 50)root(n: number, x: number)Calculates the nth root of a number.
root(2, 4) = 2 # same as sqrt(4)root(4, 16) = 2root(-4, 16) = 0.5 # same as 16^(-1/4)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.
round(2.34) = 2round(2) = 2round(2.99) = 3round(2.5) = 3sin(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.
sin(90) = 1sin(60) = 0.866sqrt(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.
sqrt(4) = 2sqrt(2) = 1.4142sqrt(-1) = NaNsum(ns: numbers)Sums a list of numbers.
sum(1) = 1sum(2, 3, 4) = 9sum({some list variable::*})sum(2, {_v::*}, and the player's y-coordinate)tan(n: number)The tangent function. This is basically sin(arg)/cos(arg). Uses degrees, not radians.
tan(0) = 0tan(45) = 1tan(89.99) = 5729.5779toBase(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.
send "Decode this binary number for a prize! %toBase({_guess}, 2)%"uuid(uuid: text)Returns a UUID from the given string. The string must be in the format of a UUID.
uuid("069a79f4-44e9-4726-a5be-fca90e38aaf5")vector(x: number, y: number, z: number)Creates a vector from a single argument. Equivalent to vector(n, n, n).
vector(1) # = vector(1, 1, 1)world(name: text)Gets a world from its name.
set {_nether} to world("%{_world}%_nether")No functions match. Search all syntax
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.