Skip to content
This repository has been archived by the owner on Aug 11, 2021. It is now read-only.

Latest commit

Β 

History

History
343 lines (238 loc) Β· 9.78 KB

REFERENCE.md

File metadata and controls

343 lines (238 loc) Β· 9.78 KB

GameMaker 1.4 Library Extensions

Contents

extension_array

  1. array_init
  2. array_of
  3. array_slice
  4. array_clone
  5. array_at
  6. array_append
  7. array_split
  8. array_flat
  9. array_sub
  10. array_reverse
  11. array_find
  12. array_count
  13. array_exists
  14. array_expand
  15. array_length
  16. array_height
  17. array_insert
  18. array_string
  19. array_sort
  20. array_replace
  21. array_swap_item
  22. array_is_1d
  23. array_filter
  24. array_2d_of

extension_ds_list

  1. ds_list_swap_item

extension_misc

  1. log
  2. assert
  3. noop
  4. type_of
  5. ternary

extension_real

  1. real_within
  2. real_within_exclusive
  3. real_is_integer
  4. real_is_natural

extension_string

  1. string_text
  2. string_join
  3. string_split
  4. string_slice
  5. string_substring
  6. string_find

Reference

extension_array

array_init(height, length)

params: real (natural), real (natural)
retruns: array with height * length items

array_init(length)

params: real (natural)
returns: array with length items
note: alias for array_create(length)

array_init()

returns: empty array
note: alias for array_create(0)

array_of(...)

params: value...
returns: creates an array from arguments

array_slice(array, from, to)

params: array (1D), real (natural), real (natural)
retruns: portion of array. from (inclusive), to (exclusive)

array_clone(array)

params: array
returns: deep copy of array, both 1D and 2D arrays

array_at(array, index)

params: array, real (natural)
returns: element in array at index (array[subindex, index])

array_at(array, height, index)

params: array, real (natural), real (natural)
returns: element in array at height, index (array[height, index])

array_append(&array, value)

params: array, value
results: appends value to array

array_append(&array, height, value)

params: array, real (natural), value
results: appends value to array at height

array_split(array, value)

params: array (1D), value
returns: 2D array, where each sub array was split by value

array_flat(array)

params: array
returns: 1D array from 2D array "flattened". array_flat([[1,2,3], [4,5,6]]) == [1,2,3,4,5,6];

array_sub(array, height)

param: array, real (natural)
retruns: 1D array from 2D array at position height

array_reverse(&array)

params: array (1D)
results: array with items in reverse order

array_find(array, value, [nth = 1])

params: array (1D), real (natural), [real (natural)]
returns: nth position where value is found in 1D array. if not found, returns -1

array_count(array, value)

params: array, value
returns: count of how many of value exists in array

array_exists(array, value)

params: array, value
returns: count of how many of value exists in array

array_expand(array)

params: array (1D)
results: array becomes all elements of nested arrays

array_length(array, [height = 0])

params: array, [real (natural)]
retruns: length of array, at height height

array_height(array)

params: array
retruns: height of array
note: alias of array_height_2d(variable)

array_insert(&array, index, value)

params: array, real (natural), value
results: array with value inserted at array[index], pushing back all items one step

array_insert(&array, height, index, value)

params: array, real (natural), real (natural), value
results: array with value inserted at array[height, index], pushing back all items one step

array_string(string)

params: string
retruns: array with each all characters as items

array_sort(&array)

params: array
results: array sorted ascendingly. if sorting string: sorted alphabetically
note: all items in array must be same type

array_replace(&array, index, value)

params: array, real (natural), value
results: array[index] replaced by value

array_replace(&array, height, index, value)

params: array, real (natural), real (natural), value
results: array[height, index] replaced by value

array_swap_item(&array, index1, index2)

params: array, real (natural), real (natural)
results: modifies array by switching items at index1 and index2

array_swap_item(&array, height, index1, index2)

params: array, real (natural), real (natural), real (natural)
results: modifies array at height by switching items at index1 and index2

array_is_1d(array)

params: value
retruns: true if array is array and has height of 1.

array_filter(array, script)

params: array (1D), script (script(val), returns bool)
results: retruns array of items which validate to true when run with script (script(array[n])).

array_2d_of(...)

params: array (1D)...
results: makes 2d array of arrays.

extension_ds_list

ds_list_swap_item(id, index_1, index_2)

params: ds_list, real (natural), real (natural)
results: swaps two elements, index_1 and index_2, in a ds_list

extension_misc

log(...)

params: value...
results: shorthand for show_debug_message

assert(comparison, [message])

params: real (boolean), [string]
results: if comparison is false, show message and exit

noop()

results: nothing. noop is shorthand for "no operation"

type_of(variable)

params: value
retruns: type of argument, as string

ternary(comparison, true_value, false_value)

params: real (bool), value, value
returns: if comparison is true, true_value, else false_value

extension_real

real_within(number, min, max)

params: real, real, real
returns: true if number is withing range min/max (inclusive: min <= number <= max)

real_within_exclusive(number, min, max)

params: real, real, real
returns: true if number is withing range min/max (exclusive: min < number < max)

real_is_integer(number)

params: real
returns: true if number is integer (no decimals)

real_is_natural(number)

params: real
returns: true if number is natural number (integer and greater or equal to 0)

extension_string

string_text(...)

params: value...
returns: converts all arguments to string

string_join(array, [joiner = ""])

params: array, [string]
returns: string with items in array joined by joiner

string_split(string, separator)

params: string, string
returns: array of strings (string_split("one,2,five", ",") == ["one", "2", "five"])
note: automatically converts parameters to strings. string_split(123456, 4) == ["123", "56"]

string_slice(string, from, to)

params: string, real (natural), real (natural)
retruns: portion of string. from (inclusive), to (exclusive).

string_substring(string, from, length)

params: string, real (natural), real (natural)
returns: string from index from to from + length. string_substring("hello world!", 6, 3) == "wor").
note: alias for string_copy(...).

string_find(source, find, [nth = 1])

params: string, string, [real (natural)]
returns: position of nth occurence of find in source. if not found, returns 0