Skip to content

Base Class Library

mystborn edited this page Jun 22, 2018 · 2 revisions

This is a temporary page highlighting the most important funtions in the Base Class Library (BCL).

Objects

The BCL defines the following objects:

General Functions

abs(num)

Argument Expected Type Description
num number The number to get the absolute value of.

Description: Returns the absolute value of number.

Returns: number

array_copy(array)

Argument Expected Type Description
source 1D array The source array.
source_index number The starting index to copy from the source array.
destination 1D array The destination array.
destination_index number The starting index of the destination to copy to.
length number The number of elements to copy.

Description: Copies the elements from the source array into the destination array, resizing the destination if needed.

Returns: null

array_create(length)

Argument Expected Type Description
length number The size of the array.

Description: Creates an array of the given length.

Returns: array

array_equals(array1, array2)

Argument Expected Type Description
array1 1D array The first array to compare.
array2 1D array The second array to compare.

Description: Determines if the elements in array1 are equal to the elements in array2.

Returns: bool

array_height_2d(array)

Argument Expected Type Description
array 2D array The 2D array to get the height of.

Description: Returns the length of the first rank of the given array.

Returns: number

array_length_1d(array)

Argument Expected Type Description
array 1D array The 1D array to get the length of.

Description: Returns the length of the array.

Returns: number

array_length_2d(array, int)

Argument Expected Type Description
array 2D array The 2D array to get the length of.
n number The index of the first dimension to get the length of.

Description: Returns the length of a second dimension of an array.

Returns: number

base64_decode(str)

Argument Exepcted Type Description
str string The string to decode.

Description: Decodes a 64 bit encoded string.

Returns: string

base64_encode(str)

Argument Exepcted Type Description
str string The string to encode.

Description: Converts a string into a base64 format encoded string.

Returns: string

call_global_script(name, ..args)

Argument Expected Type
name string
..args objects

Description: Calls the specified script with the given arguments.

Returns: object

call_instance_script(target, declaring_type, script_name, ..args)

Argument Expected Type Description
target instance The target of the script. The function will act as this instance called it, even if this instance doesn't define the script.
declaring_type string The type that defines the script, including the namespace.
script_name string The name of the script.
..args objects The arguments to pass to the script.

Description: Calls the specified script declared by the specified type as if the target called it with the given arguments.

Returns: object

ceil(value)

Argument Expected Type Description
value number The value to round up.

Description: Returns value rounded up to the nearest integer.

Returns: number

choose(..args)

Argument Expected Type Description
..args objects Any number of arguments to choose from.

Description: Takes any number of arguments and returns one at random.

Returns: object

clamp(value, min, max)

Argument Expected Type Description
value number The value to clamp.
min number The minumum possible value.
max number The maximum possible value.

Description: Returns a value clamped in between the min and max values.

Returns: number

environment_get_variable(str)

Argument Expected Type Description
str string The name of the environment variable to get.

Description: Retrieves the value of an environment variable from the current process.

Returns: string

floor(value)

Argument Expected Type Description
value number The value to round down.

Description: Returns value rounded down to the nearest integer.

Returns: number

instance_create(type, ..args)

Argument Expected Type Description
type string The type to create.
..args objects The arguments to pass to the create script.

Description: Creates a new instance of the specified type.

Returns: instance

is_array(value)

Argument Expected Type Description
value object The object to determine is an array or not.

Description: Determines if value is an array.

Returns: bool

is_number(value)

Argument Expected Type Description
value object The object to determine is a number or not.

Description: Determines if value is a number.

Returns: bool

is_string(value)

Argument Expected Type Description
value object The object to determine is a string or not.

Description: Determines if value is a string.

Returns: bool

is_delegate(value)

Argument Expected Type Description
value object The object to determine is a delegate or not.

Description: Determines if value is a delegate.

Returns: bool

is_null(value)

Argument Expected Type Description
value object The object to determine is null or not.

Description: Determines if value is null.

Returns: bool

max(..args)

Argument Expected Type Description
..args numbers Any amount of numbers.

Description: Returns the argument with the highest value.

Returns: number

min(..)

Argument Expected Type Description
..args numbers Any amount of numbers.

Description: Returns the argument with the lowest value.

Returns: number

random(n)

Argument Expected Type Description
n number The upper bound of the random number to generate.

Description: Returns a random value between 0 and n (upper bound exclusive).

Returns: number

random_get_seed()

Description: Gets the seed used to start the current random number generator.

Returns: number

random_range(min, max)

Argument Expected Type Description
min number The minumum number to generate (inclusive).
max number The maximum number to generate (exclusive).

Description: Returns a number in between min and max (min inclusive, max exclusive).

Returns: number

random_set_seed(seed)

Argument Expected Type Description
seed number The seed to set for the random number generator.

Description: Sets the seed used to start the random number generator.

Returns: null

randomise()

Description: Randomly seeds the random number generator.

Returns: null

real(str)

Argument Expected Type Description
str string The string to convert into a number.

Description: Converts a string into a number value.

Returns: number

round(value)

Argument Expected Type Description
value number The number to round.

Description: Rounds value to the nearest integer.

Returns: number

script_exists(name)

Argument Expected Type Description
name string The name of the global script.

Description: Determines if a global script with the given name exists.

Returns: bool

show_error(message, throw)

Argument Expected Type Description
message string A description of the error.
throw bool Whether to throw the program with an error, or just write to the console.

Description: Outputs an error message, optionally terminating the program.

Returns: null

string(value)

Argument Expected Type Description
value object The value to convert to a string.

Description: Converts value to a string.

Returns: string

string_char_at(str, index)

Argument Expected Type Description
str string The string to get a character from.
index number The index of character to get.

Description: Gets the character in a string at the given index.

Returns: string

string_copy(str, start, count)

Argument Expected Type Description
str string The string to copy.
start number The index to start copying from.
count number The number of characters to copy.

Description: Copies a portion of a string.

Returns: string

string_count(str, sub_string)

Argument Expected Type Description
str string The string to search.
sub_string string The string to search for.

Description: Gets the number of occurrences of the sub-string in the source.

Returns: number

string_delete(str, index, count)

Argument Expected Type Description
str string The string to remove characters from.
index number The index to start removing characters from.
count number The number of characters to remove.

Description: Returns a copy of str deleting a portion of the characters.

Returns: string

string_digits(str)

Argument Expected Type Description
str string The string to get all of the digits from.

Description: Returns the string with all non-digit characters removed.

Returns: string

string_insert(str, sub_string, index)

Argument Expected Type Description
str string The string to insert into.
sub_str string The string to insert.
index number The index in the source to insert the substring.

Description: Inserts the sub-string into the source at the given index and returns the result.

Returns: string

string_length(str)

Argument Expected Type Description
str string The string to get the length of.

Description: Returns the length of the given string.

Returns: number

string_letters(str)

Argument Expected Type Description
str string The string to get all letter characters from.

Description: Returns the string with all non-letter charaters removed.

Returns: string

string_letters_digits(str)

Argument Expected Type Description
str string The string to get all letters and numbers from.

Description: Returns the string with all non-letter and non-digit characters removed.

Returns: string

string_lower(str)

Argument Expected Type Description
str string The string to turn lowercase.

Description: Returns the string with all letters converted to lower case.

Returns: string

string_ord_at(str, index)

Argument Expected Type Description
str string The string to get the ordinal value from.
index number The index of the character to get the ordinal value of.

Description: Returns the ordinal value of the character at the specified index.

Returns: number

string_pos(str, sub_string)

Argument Expected Type Description
str string The string to search.
sub_string string The string to search for.

Description: Searches the source for the specified sub string and returns the index it was found, or -1 if it wasn't found.

Returns: number

string_repeat(str, count)

Argument Expected Type Description
str string The string to repeat.
count number The number of times the string should be repeated.

Description: Creates a string with the input repeated a number of times equal to count.

Returns: string

string_replace(str, sub_str, new_str)

Argument Expected Type Description
str string The string to search.
sub_str string The string to remove.
new_str string The string to add.

Description: Replaces the first occurrence of sub_str with new_str in the source string.

Returns: string

string_replace_all(str, sub_str, new_str)

Argument Expected Type Description
str string The string to search.
sub_str string The string to remove.
new_str string The string to add.

Description: Replaces all occurrences of sub_str with new_str in the source string.

Returns: string

string_upper(str)

Argument Expected Type Description
str string The string to turn uppercase.

Description: Returns the string with all letters converted to upper case.

Returns: string

typeof(value)

Argument Expected Type Description
value object The value to get the type of.

Description: Returns the type of the given value.

Returns: string

variable_global_exists(name)

Argument Expected Type Description
name string The name of the global variable.

Description: Determines if a global variable with the given name exists.

Returns: bool

variable_global_get(name)

Argument Expected Type Description
name string The name of the global variable to get.

Description: Gets the global variable with the given name.

Returns: object

variable_global_get_names()

Description: Gets an array of all of the currently defined global variable names.

Returns: 1D array

variable_global_set(name, value)

Argument Expected Type Description
name string The name of the global variable to set.
value object The value to set the variable to.

Description: Sets the global variable with the specified name to the given value.

Returns: null

variable_instance_exists(inst, name)

Argument Expected Type Description
inst instance The instance to check.
name string The name of the variable to check.

Description: Determines if a variable with the given name exists on the given instance.

Returns: bool

variable_instance_get(inst, name)

Argument Expected Type Description
inst instance The instance to get the value from.
name string The name of the variable to get.

Description: Gets the variable with the given name from the specified instance.

Returns: object

variable_instance_get_names(inst)

Argument Expected Type Description
inst instance The instance to get the variable names from.

Description: Gets an array of the names of all of the variables defined by the specified instance.

Returns: 1D array

variable_instance_set(inst, name, value)

Argument Expected Type Description
inst instance The instance to set the variable on.
name string The name of the variable to set.
value object The value to set the variable to.

Description: Sets the variable with the given name on the specified instance to the given value.

Returns: null

Clone this wiki locally