Class System

Class containing methods for accessing system specific properties.

Methods


system.exit

Terminates the program.

Example

main
  print "Hello Origo!"
  system.exit
                

system.launch binary file <string binaryFileName>

Restarts the runtime environment and loads a new script binary file.

Parameters

Example

main
  system.launch binary file "script.mcb"
                

(int) system.get running time in milliseconds

Returns the number of milliseconds since the program startup.

Return value

Example

main
  // running == time between program startup and call to this method.
  int running = system.get running time in milliseconds
                

(string) system.get stack trace

Returns the current stack trace as a string.

Return value

Example

main
  string sTrace = system.get stack trace
  print sTrace
                

(int) system.get total memory

Get the total amount of memory.

Return value

Example

main
  int totalMemory = system.get total memory
                

(int) system.get free memory

Get the amount of free memory available.

Return value

Example

main
  int freeMemory = system.get free memory
                

(int) system.get unix timestamp

Get the current Unix timestamp.

Return value

Example

main
  int timestamp = system.get unix timestamp
  print "Unix timestamp: " & timestamp
                

(datetime) system.get current datetime [ timezone <timezone tz = LOCAL> ]

Get the date time object that represents the current time in the chosen timezone.

Parameters

Return value

Example

main
  // Get program starting time in UTC
  datetime startTime = system.get current datetime timezone UTC
  print "Current year: " & startTime.get year
                

(font) system.get default font

Returns the system default font.

Return value

Example

main
  Font defaultFont = system.get default font
  // Do something with default font
                

(font) system.load bitmap font from file <string fontFileName>

Loads a bitmap font from a special image file. These files can be created using the 'Font Converter' tool in the Origo IDE menu 'Tools'.

Parameters

Return value

Example

main
  Font bitmapFont = system.load bitmap font from file "bitmapFont.png"
  // Do something with loaded font
                

(font) system.load bitmap font from <byte[] fontData>

Loads an origo font from a byte[] containing a special image data. These files can be created using the 'Font Converter' tool in the Origo IDE menu 'Tools'.

Parameters

Return value

Example

main
  FileReader fr = new FileReader "bitmapFont.png"
  Byte[] byteArray = fr.read fr.get size bytes
  Font bitmapFont = system.load bitmap font from byteArray
  // Do something with loaded font