GRID CARTOGRAPHER 4
Shortcuts

Global Functions

2019-04-12

GCLocale

GCLocale( string_id: string ): string

Perform a lookup into the localization table using the given string id.

getchar

getchar(): int

Try and read a character from the console. This is equivalent to GCConsole.GetChar. If no input is available, the call will wait until there is (or the user presses Ctrl+C to abort). The typed character is echoed to the console.

hash

hash( data: string ): void

Computes the CRC-32 hash of the given string. For static strings this function can be replaced by a compile-time #" prefix string literal for improved runtime performance.

include

include( file: string ): void

Load, compile and execute a script file into the virtual machine. This is a similar function to the element in a hook file but can be called selectively.

The file is searched for, in order:

  • Relative to the hook file of the script (if present)
  • Relative to the script itself if it's a command launched from the File Store folder.
  • In the User Scripts folder.
  • In the internal scripts folder (base0.zip/scripts/).

Note: This function works differently in compiled scripts, only the internal scripts folder will be checked. Use the linker to combine multiple user scripts.

Warning: If the file is not found, the script will abort immediately.

If the script causes a timeout in the Virtual Machine (for example getting caught in an infinite loop) the script will abort automatically rather than giving the user the choice. If your script triggers a false positive then consider wrapping the code in a function and calling it from the parent script after the include call has completed.

print

print( message: string|int|float ): void

Prints a text string or number to the console from the current cursor position. Special 'escape characters' found in the string are processed. See GCConsole.Print for more information.

println

println( message: string|int|float ): void

Prints a text string or number to the console from the current cursor position. This variation of print also automatically outputs a newline character immediately after the text.

printobj

printobj( object: * ): void

Print a complex object such as an array or table to the console from the current cursor position. See GCConsole.PrintObj for more information.

putchar

putchar( ch: int ): void

Write a single character to the console at the current cursor position. The ch parameter supports values from 0 to 255. Special character processing is also performed, see GCConsole.Print for more information.