Macro Module

From SolarStrike wiki
Jump to: navigation, search

See also: Basic_Info for information on how to use these functions.

init

macro.init(...)

This is an empty function that will be called once at the start of your script's execution. You should replace this with your own function. Any arguments passed to the script execution via command line will be also passed to this function.


main

macro.main(number dt)

This is an empty function that will be called once per logic cycle (~1,000 times a second). You should replace this with your own function. The only parameter received is the delta time; the amount of time (in seconds) that has passed since the last call to this function.

You are expected to return 'true' to continue script execution, or 'false' to stop script execution. You do not need to insert any rests to reduce CPU usage; this is already handled for you.

It is recommended that you do not use any long while loops; the main update function should execute quickly and constantly.


event

macro.event(string eventType, ...)

This is an empty function that will be called once for every event that is triggered. You should replace this with your own function.

'eventType' is a string that identifies which event was triggered, and the number and types of extra parameters depends on the event type.


fireEvent

macro.fireEvent(string eventType, ...)

Pushes a custom, user-defined event onto the event queue, though there are limitations. Only very basic data types are currently supported (number and string for now). The first argument must be a string and will serve as the event's type/name. You may also pass up to 15 additional strings/numbers.


getVersion

string macro.getVersion()

Returns the version as a MAJOR.MINOR.BUILD string format (ie 2.1.4)


is32bit

macro.is32bit()

Returns whether or not the MicroMacro instance is 32-bit.


is64bit

macro.is64bit()

Returns whether or not the MicroMacro instance is 64-bit.