Jebnix Standard Library (Script side) - griderd/Jebnix GitHub Wiki

This file describes standard library functions accessible from the scripting engine via Jebnix.Functions.InvokeFunction(). All code examples are written in KerboScript++. Use the appropriate language for the scripting engine you are using. In all examples, a greater-than sign is used to indicate a prompt. Output has no such symbol.

These functions are described in returnType functionName(paramType paramName,...) format. If the return type is "void", it means that the function does not return a value.

Possible types:

  • Value - Covers any one of the types listed below.
  • bool - A boolean value.
  • int - An integer value.
  • double - A double-precision floating-point value.
  • string - A string value.

If an expected type is not Value, it means that the provided value should be a literal of that type, should be a variable with the appropriate value, or should be a variable that has been cast to the appropriate type.

Example:


// this will print "0" onto the screen, as a non-numerical string is represented with 0 as an integer and double. The function abs expects a double, so "Hello World!" is automatically cast to a double of 0.
> set x to "Hello World!".
> set y to abs(x).
> print y.
0

// this will print "5" onto the screen. This requires no casting.
> set x to -5.
> set y to abs(y).
> print y.
5

// this will print "1" onto the screen. The mod function requires an integer, but the value of x is a double. x will automatically be cast to an integer.
> set x to 5.2.
> set y to mod(x, 2).
> print y.
1

Namespace: stdio

Functions

void print(Value s, bool userEntered = false)

Prints the string value of s onto the screen. If userEntered is false, the text is locked from being edited.

Example:

// Kerboscript++
> stdio:print("test).
test

void println(Value s, bool userEntered = false)

Prints the string value of s onto the screen, followed by a new line character. If userEntered is false, the text is locked from being edited.

Example:

//KerboScript++
> stdio:println("test").  
test
>

void println(bool userEntered = false)

Prints a new line character to the screen. If userEntered is false, the text is locked from being edited.

Example:

//KerboScript++
> stdio:println().

>

void clearscreen()

Clears the screen.

Value getjebnixversion()

Returns the current version of Jebnix as a string.

Namespace stdmath

This namespace contains math functions. All of these functions have aliases such that they can be called without the leading namespace.

Functions

double abs(double val)

Returns the absolute value of the float val.

int mod(int a, int b)

Returns the remainder of a divided by b.

double floor(double val)

Returns the highest integer smaller than the value given.

Example:

> print floor(5.2).
5

double ceiling(double val)

Returns the smallest integer larger than the value given.

Example:

> print ceiling(5.2).
6

double sqrt(double val)

Returns the square root of val.

double degtorad(double val)

Converts the given degrees of angle to radians.

double radtodeg(double val)

Converts the given radians of angle to degrees.

double sin(double degrees)

Returns the sine of the given degrees of angle.

double sinr(double radians)

Returns the sine of the given radians of angle.

double cos(double degrees)

Returns the cosine of the given degrees of angle.

double cosr(double radians)

Returns the cosine of the given radians of angle.

double tan(double degrees)

Returns the tangent of the given degrees of angle.

double tanr(double radians)

Returns the tangent of the given radians of angle.

double asin(double y)

Returns the arcsine of y, in degrees.

double asinr(double y)

Returns the arcsine of y, in radians.

double acos(double x)

Returns the arccosine of x, in degrees.

double acosr(double x)

Returns the arccosine of x, in radians.

double atan(double z)

Returns the arctangent of z, in degrees.

double atanr(double z)

Returns the arctangent of z, in radians.

double atan2(double y, double x)

Returns the arctangent of y divided by x, in degrees.

double atan2r(double y, double x)

Returns the arctangent of y divided by x, in radians.

double log(double base10)

Returns the logarithm of the given number, in base 10.

double log(double val, double baseN)

Returns the logarithm of val, in base baseN.

double ln(double val)

Returns the natural logarithm of val in base e.

Properties

double PI

Gets the value of PI.

double E

Gets the value of E. This is treated as a variable.

⚠️ **GitHub.com Fallback** ⚠️