List of Built-in functions
Calculates the absolute value of a number
$.assert($.abs(-100) == 100)
Allowed by default: yes
Calculates the arccos of a number
Calculates the arccosh of a number
Adds a Geometry Dash object or trigger to the target level
extract obj_props
$.add(obj {
OBJ_ID: 1,
X: 45,
Y: 45,
})
Allowed by default: yes
The object or trigger to add
Appends a value to the end of an array. You can also use array.push(value)
let arr = []
$.append(arr, 1)
$.assert(arr == [1])
Allowed by default: yes
#
Name
Type
1
arr
mutable Array
2
val
Calculates the arcsin of a number
Calculates the arcsinh of a number
Throws an error if the argument is not true
Calculates the arctan of a number
Calculates the arctan^2 of a number
Allowed by default: yes
#
Name
Type
1
x
Number
2
y
Number
Calculates the arctanh of a number
Returns the input string decoded from base64 encoding (useful for text objects)
$.b64decode("aGVsbG8gdGhlcmU=")
Allowed by default: yes
Returns the input string encoded with base64 encoding (useful for text objects)
$.b64encode("hello there")
Allowed by default: yes
Calculates the cube root of a number
$.assert($.cbrt(27) == 3)
Allowed by default: yes
Calculates the ceil of a number, AKA the number rounded up to the nearest integer
$.assert($.ceil(1.5) == 2)
Allowed by default: yes
Calculates the cos of an angle in radians
Calculates the cosh of a number
returns the value display string for the given value
$.display(counter()) // "counter(?i, bits = 16)"
Allowed by default: yes
Changes the value of an object key. You can also use object.set(key, value)
$.edit_obj(object, ROTATION, 180)
Allowed by default: yes
#
Name
Type
1
o, m
mutable Obj
2
key
3
value
Calculates the e^x of a number
Calculates the 2^x of a number
$.assert($.exp2(10) == 1024)
Allowed by default: yes
Calculates e^x - 1 in a way that is accurate even if the number is close to zero
Executes a macro in a specific trigger function context
$.extend_trigger_func(10g, () {
11g.move(10, 0, 0.5) // will add a move trigger in group 10
})
Allowed by default: yes
#
Name
Type
1
group
2
mac
Macro
Calculates the floor of a number, AKA the number rounded down to the nearest integer
$.assert($.floor(1.5) == 1)
Allowed by default: yes
Gets the fractional part of a number
$.assert($.fract(123.456) == 0.456)
Allowed by default: yes
Gets some input from the user
Sends a HTTP request
Allowed by default: no
#
Name
Type
1
method
Str
2
url
Str
3
headers
Dict
4
body
Str
Calculates the hypothenuse in a right triangle with sides a and b
$.assert($.hypot(3, 4) == 5) // because 3^2 + 4^2 = 5^2
Allowed by default: yes
#
Name
Type
1
a
Number
2
b
Number
Calculates the ln (natural log) of a number
Calculates the log base x of a number
Allowed by default: yes
#
Name
Type
1
n
Number
2
base
Number
Returns true
if the value matches the pattern, otherwise it returns false
$.matches([1, 2, 3], [@number])
Allowed by default: yes
#
Name
Type
1
val
2
pattern
Calculates the max of two numbers
$.assert($.max(1, 2) == 2)
Allowed by default: yes
#
Name
Type
1
a
Number
2
b
Number
Calculates the min of two numbers
$.assert($.min(1, 2) == 1)
Allowed by default: yes
#
Name
Type
1
a
Number
2
b
Number
Checks if a value reference is mutable
const = 1
$.assert(!$.mutability(const))
let mut = 1
$.assert($.mutability(mut))
Allowed by default: yes
Removes a value from the end of an array, and returns it. You can also use array.pop()
let arr = [1, 2, 3]
$.assert($.pop(arr) == 3)
$.assert(arr == [1, 2])
Allowed by default: yes
#
Name
Type
1
arr
mutable
Prints value(s) to the console
Allowed by default: yes
any
Generates random numbers, or picks a random element of an array
$.random() // a completely random number
$.random([1, 2, 3, 6]) // returns either 1, 2, 3, or 6
$.random(1, 10) // returns a random integer between 1 and 10
Allowed by default: yes
see example
Returns the contents of a file in the local system
data = $.readfile("file.txt")
Allowed by default: no
Path of file to read, and the format it's in ("text", "bin", "json", "toml" or "yaml")
Performs a regex operation on a string
Allowed by default: yes
mode
can be either "match", "replace" or "findall"
#
Name
Type
1
regex
Str
2
s
Str
3
mode
Str
4
replace
Removes a specific value from an array. You can also use array.remove(index)
Allowed by default: yes
#
Name
Type
1
arr
mutable
2
index
Number
Rounds a number
$.assert($.round(1.2) == 1)
Allowed by default: yes
Calculates the sin of an angle in radians
Calculates the hyperbolic sin of a number
Returns an array from the split string. You can also use string.split(delimiter)
$.assert($.split_str("1,2,3", ",") == ["1", "2", "3"])
Allowed by default: yes
#
Name
Type
1
s
Str
2
substr
Str
Gets the current version of spwn
Allowed by default: yes
none
Calculates the square root of a number
Returns a specified part of the input string
$.substr("hello there", 1, 5)
Allowed by default: yes
#
Name
Type
1
val
Str
2
start_index
Number
3
end_index
Number
Calculates the tan of an angle in radians
Calculates the hyperbolic tan of a number
Gets the current system time in seconds
Allowed by default: yes
none
Returns the start group of the current trigger function context
Allowed by default: yes
none
Writes a string to a file in the local system (any previous content will be overwritten, and a new file will be created if it does not already exist)
$.write_file("file.txt", "Hello")
Allowed by default: no
#
Name
Type
1
path
Str
2
data
Str
Default Implementations for Operators
Default implementation of the +=
operator
Allowed by default: yes
#
Name
Type
1
a
mutable
2
b
Default implementation of the &&
operator
Allowed by default: yes
#
Name
Type
1
a
Bool
2
b
Bool
Default implementation of the as
operator
Allowed by default: yes
#
Name
Type
1
a
2
t
TypeIndicator
Default implementation of the =
operator
Allowed by default: yes
#
Name
Type
1
a
mutable
2
b
Default implementation of the n--
operator
Allowed by default: yes
#
Name
Type
1
a
mutable Number
returns the default value display string for the given value
$._display_(counter()) // "@counter::{ item: ?i, bits: 16 }"
Allowed by default: yes
Default implementation of the /=
operator
Allowed by default: yes
#
Name
Type
1
a
mutable Number
2
b
Number
Default implementation of the /
operator
Allowed by default: yes
#
Name
Type
1
a
Number
2
b
Number
Default implementation of the |
operator
$._either_(@number, @counter)
Allowed by default: yes
Default implementation of the ==
operator
$._equal_("hello", "hello")
Allowed by default: yes
Default implementation of the ^=
operator
Allowed by default: yes
#
Name
Type
1
a
mutable Number
2
b
Number
Default implementation of the has
operator
Default implementation of the n++
operator
Allowed by default: yes
#
Name
Type
1
a
mutable Number
Default implementation of the /%=
operator
Allowed by default: yes
#
Name
Type
1
a
mutable Number
2
b
Number
Default implementation of the /%
operator
Allowed by default: yes
#
Name
Type
1
a
Number
2
b
Number
Default implementation of the <=
operator
$._less_or_equal_(100, 100)
Allowed by default: yes
#
Name
Type
1
a
Number
2
b
Number
Default implementation of the <
operator
Allowed by default: yes
#
Name
Type
1
a
Number
2
b
Number
Default implementation of the -
operator
Allowed by default: yes
#
Name
Type
1
a
Number
2
b
Number
Default implementation of the %
operator
Allowed by default: yes
#
Name
Type
1
a
Number
2
b
Number
Default implementation of the %=
operator
Allowed by default: yes
#
Name
Type
1
a
mutable Number
2
b
Number
Default implementation of the >=
operator
$._more_or_equal_(100, 100)
Allowed by default: yes
#
Name
Type
1
a
Number
2
b
Number
Default implementation of the >
operator
Allowed by default: yes
#
Name
Type
1
a
Number
2
b
Number
Default implementation of the *=
operator
Allowed by default: yes
#
Name
Type
1
a
mutable
2
b
Number
Default implementation of the -n
operator
Default implementation of the !b
operator
Default implementation of the !=
operator
$._not_equal_("hello", "bye")
Allowed by default: yes
Default implementation of the ||
operator
Allowed by default: yes
#
Name
Type
1
a
Bool
2
b
Bool
Default implementation of the +
operator
Default implementation of the ^
operator
Allowed by default: yes
#
Name
Type
1
a
Number
2
b
Number
Default implementation of the --n
operator
Allowed by default: yes
#
Name
Type
1
a
mutable Number
Default implementation of the ++n
operator
Allowed by default: yes
#
Name
Type
1
a
mutable Number
Default implementation of the ..
operator
Allowed by default: yes
#
Name
Type
1
val_a
2
b
Number
Default implementation of the -=
operator
Allowed by default: yes
#
Name
Type
1
a
mutable Number
2
b
Number
Default implementation of the <=>
operator
Allowed by default: yes
#
Name
Type
1
a
mutable
2
b
mutable
Default implementation of the *
operator
Allowed by default: yes
#
Name
Type
1
a
2
b
Number
Default implementation of the ..n
operator