User's Scripts
Parse a numeric string in some specified base and the quantity as an integer
Generates a string representation of an integer using the specified base
Tests whether the line (NOT line segment) running from (x1, y1) to (x2, y2) intersects the line running from (x3, y3) to (x4, y4).
Constructs a Roman numeric representation of a given integer (which should be typed as a real, not a string) between 1 and 3,999,999.
Returns the Soundex code of some string
Returns a hexadecimal string representation of some integer (which should be given as a real, not a string).
Generate a string based on the given format, mimicking the behavior of printf in other languages. This is a simplified version of the routine, so it only supports the following...
Inverts the case of some string, making all the lowercase letters uppercase and vice-versa.
Splits a string into parts of size part_size and returns the pieces in a ds_list. For example, string_split("abcdefg", 2) yields [ab, cd, ef, g].
Pads some string to a certain length by applying some pad string on the direction of choice.
GML's modulo operator is implemented in such a way that the result always has the same sign as the dividend. For example, (-7 mod 2) evaluates to -1. This script implements the...
Returns a string describing the given time interval (dt) in English. For example, timediff(1000*60*60*34) will give "one day, ten hours".
Trims characters from the end of a string until it is no wider than max_width. If trimming is necessary, the suffix (typically "...") will be appended on to the end of the string....
Trims characters from the end of a string until it is no longer than max_length. If trimming is necessary, the suffix (typically "...") will be appended on to the end of the string....
Returns whether some number is in the set of odd numbers: {.., -3, -1, 1, 3, ..}
Return whether some number is in the set of even numbers: {.., -4, -2, 0, 2, 4, ..}
A general primality test
Tests whether some subset of the given list has a given sum. The algorithm is fast with small (target) sums, but slow with larger ones.
Returns a modified version of n with some specified bit set to val. bit=0 indicates the least significant bit (worth 1, usually written on the far right), bit=1 indicates the next...
Extracts one bit from some number n. bit=0 indicates the least significant bit (worth 1, usually written on the far right), bit=1 indicates the next (worth 2), and so forth; in...
Folds a ds_list from right to left and returns the result. This works as follows. The first sub-result is obtained by executing scr with two arguments: init, and the last element of the list....
Folds a ds_list from left to right and returns the result. This works as follows. The first sub-result is obtained by executing scr with two arguments: init, and the first element of the list....
Normalizes a list of reals so that all the entries add up to 1
Draws some text in the pattern of a wave with the given magnitude
Returns the sum of two matrices. These should both be ds_grids filled with real entries.
Returns the whether some matrix M is symmetric, i.e., equivalent to its transpose. M should be a ds_grid filled with real entries.
Returns the transpose of some matrix M. This should be a ds_grid filled with real entries.
Returns whether some square matrix M is a diagonal matrix. M should be a ds_grid filled with real entries.
Returns whether some square matrix M is a lower triangular matrix. M should be a ds_grid filled with real entries.
Returns whether some square matrix M is an upper triangular matrix. M should be a ds_grid filled with real entries.
Returns the determinant of some square matrix M using the recursive method. M should be a ds_grid filled with real entries.
Returns an identity matrix with the given dimension
Returns the exponential of some square matrix M. This should both a ds_grid filled with real entries.
This script uses the simple optimization of M^(2n) = (M^n)*(M^n), so it consumes O(log n) time....
Returns the matrix product of M1 and M2. These should both be ds_grids filled with real entries. This script uses the simple O(n^3) technique.
Returns a scaled transformation of some matrix M. This should be a ds_grid filled with real entries.
Computes the n'th number in the fibonacci sequence. This is faster than the iterative method, but loses precision more quickly, making it accurate up to n=75....
Computes the n'th number of the fibonacci sequence iteratively, taking O(n) time. This is accurate up to n=78.
Tests whether the point (x, y) lies inside a circle with vertex (xv, yv) and radius r
Constructs (and returns) a concatenation of L1 and L2 without mofifying either of the two lists
Draws some text progressively, with a given delay between each character. The user can hold down a key (shift by default) to speed up the progression, or another key (space by...
"Encrypts" a string using the classic rot13 algorithm. (See
ROT13 on Wikipedia.)
Transforms each element of a list by mapping it through a 1-ary script
Filters a list by calling script on each element and retaining only the elements for which the (1-ary) script returns true
Reverses the order of elements in some list with minimal overhead
Returns a string representation of the given grid
Returns a string representation of the given priority queue
Returns a string representation of the given map
Returns a string representation of the given queue
Returns a string representation of the given stack
Scrambles the characters in a string
Draws a pie chart illustrating the given list of data. The list does not need to be normalized; this is done automatically. Note that this function only draws the shape of the chart, not the labels....
Tests whether two pieces of data are equal in both type and content. Useful for avoiding errors from comparing strings with reals.
Tests whether n is a power of base; more precisely, whether there exists some power p such that base^p = n.
Computes how many unique natural numbers divide evenly into the argument
Returns a string representation of a list in the form [E1, E2, ...]. Useful for debugging.
Returns the smallest real in a list of reals
Returns the largest real in a list of reals
Sums the entries in a list of reals
This script sorts a list using a given quantifier script. This should be a 1-ary script which takes a list element as input and returns a real value that can be used in sorting.
For...
Efficiently removes redundant elements from a list
Returns a randomly-selected element of the given list
Converts the first character of each word in a string to uppercase
Converts the first character of a string to uppercase
Removes whitespace from both sides of a string
An efficient method for drawing multiple lines of text with word wrapping. The arguments are identical to those used in draw_text_ext.
Computes the factorial of some number iteratively, avoid the overhead of recursion
Generates a random integer between min and max, inclusive
Joins together multiple strings (pieces) into one combined string
Breaks apart a string into a list of pieces separated by delimiter
A very customizable function for drawing text with an outline
GM contains something of an inconsistency, arguably a bug. In general, it does not limit you to the dimensions you choose to give to your room - it will handle instances that go...
Generates a random word. The result may not be an actual dictionary term, but it should have a natural sound (resulting from a good consonant/vowel arrangement)....
Returns a randomly-chosen consonant or vowel
Rotate some angle toward some other target angle with a given speed, slowing down as the target comes near
Rotate some angle toward some other target angle with a given speed
Draw text with a shadow underneath
Converts a decimal number into a fraction (represented as a string)
The decryption function corresponding to string_encrypt
A standard encryption function
Unpacks data stored with data_pack function and stores the individual values in an array
Packs the given data pieces into a single value and returns it as a condensed string
Converts a binary sequence string to an ASCII string
Converts a regular string to a binary sequence string
Converts a binary sequence of any size into integer format
Converts an integer of any size into binary format
Reverses the characters in a string
Tests whether the given string is palindromic
A highly generalized function for drawing circular shapes