Global functions#
Functions#
void |
Quit() |
void |
|
void |
|
void |
Waitframes(int count) |
void |
Waitdraw() |
void |
WaitTo(int timing, bool at_least = |
int |
|
void |
Trace(untyped val) |
void |
Trace(long val) |
void |
TraceB(bool val) |
void |
TraceS(char32[] string) |
void |
TraceNL() |
void |
|
void |
TraceToBase(int val, int base, int mindigits) |
int |
Sin(int deg) |
int |
Cos(int deg) |
int |
Tan(int deg) |
int |
ArcTan(int x, int y) |
int |
ArcSin(int x) |
int |
ArcCos(int x) |
int |
RadianSin(int rad) |
int |
RadianCos(int rad) |
int |
RadianTan(int rad) |
int |
Pow(int base, int exp) |
long |
LPow(long base, long exp) |
int |
InvPow(int base, int exp) |
int |
Factorial(int val) |
int |
Abs(int val) |
int |
Log10(int val) |
int |
Ln(int val) |
int |
Sqrt(int val) |
void |
CopyTile(int src, int dest) |
void |
SwapTile(int a, int b) |
void |
ClearTile(int tile) |
int |
SizeOfArray(T[] arr) |
void |
ResizeArray(T[] arr, int size) |
void |
OwnArray(T[] arr) |
void |
DestroyArray(T[] arr) |
void |
OwnObject(untyped obj) |
void |
GlobalObject(untyped obj) |
void |
OverlayTile(int src, int dest) |
T |
Floor(T val) |
T |
Ceiling(T val) |
T |
Truncate(T n) |
T |
Round(T n) |
T |
RoundAway(T n) |
int |
GetSystemTime(int index) |
int |
Distance(int x1, int y1, int x2, int y2) |
int |
Distance(int x1, int y1, int x2, int y2, int scale) |
long |
LongDistance(long x1, long y1, long x2, long y2) |
long |
LongDistance(long x1, long y1, long x2, long y2, long scale) |
int |
strcmp(char32[] str1, char32[] str2) |
int |
strncmp(char32[] str1, char32[] str2, int num_chars) |
int |
stricmp(char32[] str1, char32[] str2) |
int |
strnicmp(char32[] str1, char32[] str2, int num_chars) |
void |
strcpy(char32[] dest, char32[] src) |
void |
itoacat(char32[] dest, int val) |
void |
ArrayCopy(T[] dest, T[] src) |
int |
strlen(char32[] str) |
int |
atoi(char32[] str) |
long |
atol(char32[] arg1) |
int |
ilen(char32[] string) |
void |
utol(char32[] string) |
void |
ltou(char32[] string) |
void |
convcase(char32[] string) |
int |
itoa(char32[] dest, int val) |
int |
xtoa(char32[] dest, int val) |
int |
xtoi(char32[] str) |
int |
SaveSRAM(char32[] filename, int flags) |
int |
LoadSRAM(char32[] filename, int flags) |
int |
strcat(char32[] dest, char32[] src) |
int |
strchr(char32[] str, int c) |
int |
strcspn(char32[] str, char32[] chars) |
int |
strspn(char32[] str, char32[] string_keys) |
int |
strstr(char32[] str, char32[] tofind) |
int |
strrchr(char32[] str, int c) |
bool |
IsValidArray(T[] arr) |
int |
DegtoRad(int degrees) |
int |
RadtoDeg(int radians) |
int |
WrapRadians(int radians) |
int |
WrapDegrees(int degrees) |
void |
printf(char32[] format, untyped varargs …) |
int |
sprintf(char32[] dest, char32[] format, untyped varargs …) |
void |
printfa(char32[] format, T[] args) |
int |
sprintfa(char32[] dest, char32[] format, T[] args) |
T |
Max(T val1, T val2, T varargs …) |
T |
Min(T val1, T val2, T varargs …) |
T |
Choose(T arg1, T varargs …) |
bool |
ArrayPushBack(T[] arr, T val) |
bool |
ArrayPushFront(T[] arr, T val) |
bool |
ArrayPushAt(T[] arr, T val, int index) |
T |
ArrayPopBack(T[] arr) |
T |
ArrayPopFront(T[] arr) |
T |
ArrayPopAt(T[] arr, int index) |
int |
Rand(int arg1) |
void |
SRand(long seed) |
long |
SRand() |
untyped |
Untype(untyped value) deprecated |
int |
Byte(int n) deprecated |
int |
Int8(int n) deprecated |
int |
SignedByte(int n) deprecated |
int |
Word(int n) deprecated |
int |
Int16(int n) deprecated |
int |
Short(int n) deprecated |
int |
Integer(int n) deprecated |
int |
GetScriptRAM(int arg1) deprecated |
void |
SetScriptRAM(int arg1, int arg2) deprecated |
int |
GetGlobalRAM(int arg1) deprecated |
void |
SetGlobalRAM(int arg1, int arg2) deprecated |
void |
SetColorBuffer(int arg1, int arg2, int arg3, int arg4) deprecated |
void |
SetDepthBuffer(int arg1, int arg2, int arg3, int arg4) deprecated |
void |
GetColorBuffer(int arg1, int arg2, int arg3, int arg4) deprecated |
void |
GetDepthBuffer(int arg1, int arg2, int arg3, int arg4) deprecated |
long |
RefCount(untyped arg1) |
void |
GC() |
Function descriptions#
Exits the current script entirely. Has the same effect as void run()
ending.
Exits the current script entirely, and forcibly skips the de-allocating of objects ‘Owned’ by the script. Only use this if you know what you are doing!
Yields the script to the engine for the current frame. The engine will proceed with one frame of gameplay before resuming this execution of this script.
void Waitframes(int count) 🔗 Source
Waitframe() for ‘count’ frames in a row.
If ‘count <= 0’, no wait occurs.
‘count’ will be rounded up.
When called the first time in a frame, the script ends running for a portion of time. The engine will proceed with part of a frame of gameplay, allowing other engine activities to occur, before resuming this script.
void WaitTo(int timing, bool at_least = false
) 🔗 Source
Can only be used in a passively-running Generic Script.
Can only be used in a passively-running Generic Script.
void Trace(untyped val) 🔗 Source
Prints the passed value to the output console. Includes a newline character after the value.
Prints the passed value to the output console. Includes a newline character after the value.
void TraceB(bool val) 🔗 Source
Prints the passed value to the output console, as “true” if the value is nonzero, or “false” if the value is 0. Includes a newline character after the value.
void TraceS(char32[] string) 🔗 Source
Prints the passed string to the output console. Does not include a newline character after the string.
Prints a newline character to the output console.
Clears the logs from ${allegro.log}, and clears the ${output console}.
void TraceToBase(int val, int base, int mindigits) 🔗 Source
Prints the passed value to the output console, in the specified base, where
“2 <= base
<= 36”. Value will be floored before print, so decimal values
are not printed. Will print at least ‘mindigits digits, using leading 0s as
needed. Includes a newline character after the value.
Returns the trig Sin of the degree value given.
Returns the trig Cos of the degree value given.
Returns the trig Tan of the degree value given.
int ArcTan(int x, int y) 🔗 Source
Returns the trig ArcTan of the values given.
Returns the trig ArcSin of the value given.
Returns the trig ArcCos of the value given.
int RadianSin(int rad) 🔗 Source
Returns the trig Sin of the radian value given.
int RadianCos(int rad) 🔗 Source
Returns the trig Cos of the radian value given.
int RadianTan(int rad) 🔗 Source
Returns the trig Tan of the radian value given.
int Pow(int base, int exp) 🔗 Source
Returns ‘base**exp’, with ‘0**0==1’. Negative values of ‘exp’ work, though may not be useful, as the return value is truncated to the nearest integer.
long LPow(long base, long exp) 🔗 Source
Returns ‘base**exp’, with ‘0**0==1’. Negative values of ‘exp’ work, though may not be useful, as the return value is truncated to the nearest long.
int InvPow(int base, int exp) 🔗 Source
Returns ‘base**(1/exp)’, undefined if ‘exp’ is 0, or if ‘exp’ is even and ‘base’ is negative. Negative values of ‘exp’ work, though may not be useful, as the return value is truncated to the nearest integer.
int Factorial(int val) 🔗 Source
Returns val!
. Returns 0
for negative values.
Returns the absolute value of the parameter.
Returns the log\_10 of the value. Values <= 0 return 0.
Returns the natural log (log\_e) of the value. Values <= 0 return 0.
Returns the square root of the value. Undefined for negative values, and will return an error.
void CopyTile(int src, int dest) 🔗 Source
Copies tile src
to tile dest
.
void SwapTile(int a, int b) 🔗 Source
Swaps the tiles ‘a’ and ‘b’.
void ClearTile(int tile) 🔗 Source
Clears the tile ‘tile’ to be blank.
int SizeOfArray(T[] arr) 🔗 Source
Returns the size of the array
void ResizeArray(T[] arr, int size) 🔗 Source
Resizes the array ‘arr’ to size ‘size’. If ‘size’ is <1, the array becomes size 1 instead.
void OwnArray(T[] arr) 🔗 Source
Grants ownership of the target array to the currently running script.
void DestroyArray(T[] arr) 🔗 Source
If arr
is a local array, destroys it immediately. Otherwise does nothing.
void OwnObject(untyped obj) 🔗 Source
Takes an Object parameter. Grants ownership of the object to the currently running script.
void GlobalObject(untyped obj) 🔗 Source
Takes an Object parameter. Globalizes the object, making it no longer owned by any script.
void OverlayTile(int src, int dest) 🔗 Source
Overlays tile src
over tile dest
.
Returns val
rounded down to the next lower integer.
Returns val
rounded up to the next higher integer.
Truncates n
to the nearest integer, rounding towards 0.
Truncates n
to the nearest integer.
Truncates n
to the nearest integer, rounding away from 0.
int GetSystemTime(int index) 🔗 Source
Returns information from the real-time clock of the system.
int Distance(int x1, int y1, int x2, int y2) 🔗 Source
Calculates the distance between two points, optionally using a scale divisor to handle distances that would otherwise overflow.
int Distance(int x1, int y1, int x2, int y2, int scale) 🔗 Source
Calculates the distance between two points, optionally using a scale divisor to handle distances that would otherwise overflow.
long LongDistance(long x1, long y1, long x2, long y2) 🔗 Source
Same as Distance(), but takes distances as ‘long’ coordinates, returning a ‘long’ distance value.
long LongDistance(long x1, long y1, long x2, long y2, long scale) 🔗 Source
Same as Distance(), but takes distances as ‘long’ coordinates, returning a ‘long’ distance value.
int strcmp(char32[] str1, char32[] str2) 🔗 Source
Compares the contents of the two strings.
int strncmp(char32[] str1, char32[] str2, int num_chars) 🔗 Source
Compares the contents of the two strings.
int stricmp(char32[] str1, char32[] str2) 🔗 Source
Compares the contents of the two strings.
int strnicmp(char32[] str1, char32[] str2, int num_chars) 🔗 Source
Compares the contents of the two strings.
void strcpy(char32[] dest, char32[] src) 🔗 Source
Copies the string src
to dest
.
void itoacat(char32[] dest, int val) 🔗 Source
Appends the value val
on the end of the dest
string; combining itoa()
with strcat().
void ArrayCopy(T[] dest, T[] src) 🔗 Source
Copies all data from src
to dest
. If the arrays are not the same size,
the smaller size is used, and the excess in the larger array is ignored.
int strlen(char32[] str) 🔗 Source
Returns the length of the string in characters.
int atoi(char32[] str) 🔗 Source
Converts a string containing a number to its numeric value.
long atol(char32[] arg1) 🔗 Source
int ilen(char32[] string) 🔗 Source
Returns the number of characters in the string that are taken up by a number (as would be read by [atoi, including negative sign)
void utol(char32[] string) 🔗 Source
Lowercases the string (modifies).
void ltou(char32[] string) 🔗 Source
Uppercases the string (modifies).
void convcase(char32[] string) 🔗 Source
Swaps casing (a->A, A->a) for the string passed (modifies).
int itoa(char32[] dest, int val) 🔗 Source
Converts the value val
to a string, and writes to dest
.
int xtoa(char32[] dest, int val) 🔗 Source
Converts val
to a string, as hexadecimal, and writes to dest
.
int xtoi(char32[] str) 🔗 Source
Converts a string containing a hexadecimal number to its numeric value.
int SaveSRAM(char32[] filename, int flags) 🔗 Source
Saves/loads internal data (which is normally temporarily altered by scripts)
of the types specified in flags
.
int LoadSRAM(char32[] filename, int flags) 🔗 Source
Saves/loads internal data (which is normally temporarily altered by scripts)
of the types specified in flags
.
int strcat(char32[] dest, char32[] src) 🔗 Source
Appends src
to the end of dest
. Returns dest
.
int strchr(char32[] str, int c) 🔗 Source
Returns the first index of str
that contains the character c
.
int strcspn(char32[] str, char32[] chars) 🔗 Source
Returns the length in str
before any character in ‘chars’ is found.
int strspn(char32[] str, char32[] string_keys) 🔗 Source
Returns the number of characters in a string before a character not contained in
‘string_keys’ is found
int strstr(char32[] str, char32[] tofind) 🔗 Source
Returns the index of the first instance of the string tofind
within str
.
int strrchr(char32[] str, int c) 🔗 Source
Returns the last index of str
that contains the character c
.
bool IsValidArray(T[] arr) 🔗 Source
Returns true if the value ‘arr’ points to a valid array.
int DegtoRad(int degrees) 🔗 Source
Converts Degrees to Radians. More accurate than the old std_functions DegtoRad.
Because radians are mostly decimal and zscript can only have 4 decimals, there is very minor inaccuracies
with this conversion that are not feasibly fixable; however, it is still more accurate than the old std.zh conversion function,
where the old conversion could potentially be 2 entire degrees off at certain angles, while this version only loses about 0.0004 degrees of accuracy.
In addition, casting between DegtoRad() and RadtoDeg() repeatedly will *not* lose additional precision with each call; only the first call will lose precision.
int RadtoDeg(int radians) 🔗 Source
Converts Radians to Degrees. More accurate than the old std_functions RadtoDeg.
See DegtoRad() for more details on how this is more accurate.
int WrapRadians(int radians) 🔗 Source
Returns the radians
value, wrapped between [-PI,PI)
int WrapDegrees(int degrees) 🔗 Source
Returns the degrees
value, wrapped between [-180,180)
void printf(char32[] format, untyped varargs …) 🔗 Source
Prints the specified format_string to the output console, using the given args to fill in parts of the string that are specially marked. Does not include a newline character after the string.
int sprintf(char32[] dest, char32[] format, untyped varargs …) 🔗 Source
Acts exactly as output console, it is instead placed in the dest
buffer. If
the dest
buffer is too small, it will be resized to fit the contents.
void printfa(char32[] format, T[] args) 🔗 Source
Prints the specified format_string to the output console, using the given args to fill in parts of the string that are specially marked. Does not include a newline character after the string.
int sprintfa(char32[] dest, char32[] format, T[] args) 🔗 Source
Acts exactly as output console, it is instead placed in the dest
buffer. If
the dest
buffer is too small, it will be resized to fit the contents.
T Max(T val1, T val2, T varargs …) 🔗 Source
Returns the largest parameter.
T Min(T val1, T val2, T varargs …) 🔗 Source
Returns the smallest parameter.
T Choose(T arg1, T varargs …) 🔗 Source
Returns a random parameter, using the global RandGen.
bool ArrayPushBack(T[] arr, T val) 🔗 Source
Increases the size of the array by 1, inserting val
at the
back of the array.
bool ArrayPushFront(T[] arr, T val) 🔗 Source
Increases the size of the array by 1, inserting val
at the
front of the array.
bool ArrayPushAt(T[] arr, T val, int index) 🔗 Source
Increases the size of the array by 1, inserting val
at the
specified index of the array. If an invalid index is passed, the
back of the array will be targetted.
T ArrayPopBack(T[] arr) 🔗 Source
Decreases the size of the array by 1, removing and returning the element at the back of the array.
T ArrayPopFront(T[] arr) 🔗 Source
Decreases the size of the array by 1, removing and returning the element at the front of the array.
T ArrayPopAt(T[] arr, int index) 🔗 Source
Decreases the size of the array by 1, removing and returning the element at the specified index of the array. If an invalid index is passed, the back of the array will be targetted.
void SRand(long seed) 🔗 Source
Sets the current random seed to a given value, input from script. (DOES NOT /10000)
Generates a random seed, sets it, and returns it.
untyped Untype(untyped value) 🔗 Source
Converts the type of any value to untyped
, exactly like typecasting.
Example:
Warning
Deprecated! Use casting <untyped>(var)
instead!
Clamps and returns n
sized to an unsigned byte, with appropriate overflow.
Warning
Deprecated!
Clamps and returns n
sized to an unsigned byte, with appropriate overflow.
Warning
Deprecated!
int SignedByte(int n) 🔗 Source
Clamps and returns n
sized to a signed byte, with appropriate overflow.
Warning
Deprecated!
Clamps and returns n
sized to an unsigned 16-bit integer, with appropriate
overflow.
Warning
Deprecated!
Clamps and returns n
sized to an unsigned 16-bit integer, with appropriate
overflow.
Warning
Deprecated!
Clamps and returns n
sized to a signed 16-bit integer, with appropriate
overflow.
Warning
Deprecated!
Truncates n to an integer.
Warning
Deprecated!
int GetScriptRAM(int arg1) 🔗 Source
Warning
Deprecated!
void SetScriptRAM(int arg1, int arg2) 🔗 Source
Warning
Deprecated!
int GetGlobalRAM(int arg1) 🔗 Source
Warning
Deprecated!
void SetGlobalRAM(int arg1, int arg2) 🔗 Source
Warning
Deprecated!
void SetColorBuffer(int arg1, int arg2, int arg3, int arg4) 🔗 Source
Warning
Deprecated!
void SetDepthBuffer(int arg1, int arg2, int arg3, int arg4) 🔗 Source
Warning
Deprecated!
void GetColorBuffer(int arg1, int arg2, int arg3, int arg4) 🔗 Source
Warning
Deprecated!
void GetDepthBuffer(int arg1, int arg2, int arg3, int arg4) 🔗 Source
Warning
Deprecated!
long RefCount(untyped arg1) 🔗 Source