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
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
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
>
Prints a new line character to the screen. If userEntered is false, the text is locked from being edited.
Example:
//KerboScript++
> stdio:println().
>
Clears the screen.
Returns the current version of Jebnix as a string.
This namespace contains math functions. All of these functions have aliases such that they can be called without the leading namespace.
Returns the absolute value of the float val.
Returns the remainder of a divided by b.
Returns the highest integer smaller than the value given.
Example:
> print floor(5.2).
5
Returns the smallest integer larger than the value given.
Example:
> print ceiling(5.2).
6
Returns the square root of val.
Converts the given degrees of angle to radians.
Converts the given radians of angle to degrees.
Returns the sine of the given degrees of angle.
Returns the sine of the given radians of angle.
Returns the cosine of the given degrees of angle.
Returns the cosine of the given radians of angle.
Returns the tangent of the given degrees of angle.
Returns the tangent of the given radians of angle.
Returns the arcsine of y, in degrees.
Returns the arcsine of y, in radians.
Returns the arccosine of x, in degrees.
Returns the arccosine of x, in radians.
Returns the arctangent of z, in degrees.
Returns the arctangent of z, in radians.
Returns the arctangent of y divided by x, in degrees.
Returns the arctangent of y divided by x, in radians.
Returns the logarithm of the given number, in base 10.
Returns the logarithm of val, in base baseN.
Returns the natural logarithm of val in base e.
Gets the value of PI.
Gets the value of E. This is treated as a variable.