Skript

The central library.

The root-level skript namespace is provided by ByteSkript and contains a number of basic functions and operations for controlling the system or providing useful functionality.

The skript library is available by default, so functions can be run directly with function(args) rather than the external function(args) from library.

This library is currently implemented in Java.

Generic

These functions provide basic utilities, mostly related to the JDK System class.

FunctionDescription

get_class(name)

Returns the Class object with the provided name, or nothing if it doesn't exist.

get_atomic_literal(object)

Returns the given atomic variable as a regular object to be stored in a value variable.

current_time_millis()

Returns the current time in milliseconds as a Long. Useful for comparing time passed.

line_separator()

Returns the system's line-separator character ( or etc.)

nano_time()

Returns the system nanosecond time as a Long. Useful for comparing time passed.

hashcode(object)

Returns the provided Integer hash code of an object.

strict_equals(object, object)

Performs a strict ACMP equals check on the objects, returning true if they reference the same object in memory or false if not.

weak_reference(object)

Creates a 'weak' reference to an object.

soft_reference(object)

Creates a 'soft' reference to an object.

reference_value(reference)

Retrieves the value of a reference.

Maths

These functions provide basic mathematical operators and routines.

All have null-safety and will treat a null value as 0. If a non-number is passed as a parameter, the function will throw an error when trying to convert it.

All trigonometric functions are provided in degrees. All hyperbolic functions return in degrees.

FunctionDescription

abs(number)

Returns the absolute (positive) value of the number.

sqrt(number)

Returns the square root of the number.

newton_root(number, accuracy)

An alternative root function when accuracy can be sacrificed for speed. The accuracy should be an integer >= 0. Higher accuracy will make the function slower.

ceil(number)

Raises the value to the nearest integer.

floor(number)

Lowers the value to the nearest integer.

round(number)

Rounds the value to the nearest integer.

ln(number)

Returns the natural logarithm of the value.

log(number)

Returns the logarithm of the value.

to_degrees(number)

Converts radians to degrees.

to_radians(number)

Converts degrees to radians.

sin(number)

Sine function.

cos(number)

Cosine function.

tan(number)

Tangent function.

sinh(number)

Hyperbolic sine function.

cosh(number)

Hyperbolic cosine function.

tanh(number)

Hyperbolic tangent function.

asin(number)

Arcus sine function.

acos(number)

Arcus cosine function.

atan(number)

Arcus tangent function.

atan2(x, y)

Two-argument arcus tangent function.

Handles

These functions can be used to obtain executable 'handles' or values of members from Java classes.

Advanced users may use these to run Java code.

FunctionDescription

get_java_method(owner, name, parameters)

Provides an executable for a Java method. The owner is the class for a static method, or the object to call it on for a dynamic method. The parameters is a list or array of the parameter classes. This may then be called with run {method} with {args}.

get_java_method(owner, name)

Provides an executable for a Java method with no parameters. The owner is the class for a static method, or the object to call it on for a dynamic method. This may then be called with run {method} with {args}.

has_java_field(owner, name)

The owner is the class for a static field, or the object to call it on for a dynamic field. Returns true if the field is present, otherwise false.

get_java_field(owner, name)

The owner is the class for a static field, or the object to call it on for a dynamic field. Returns the field value, not an executable object.

set_java_field(owner, name, value)

The owner is the class for a static field, or the object to call it on for a dynamic field. Attempts to set the target field to the given value, with automatic boxing.

Last updated