1.0.5.0 - LUA Scripting
Moonrock
- - Removed JSON based triggers
- + LUA Interpreter: Moonrock now has a full scripting system using Lua. The scripts can run on triggers (like the old system) or you can start a main script that totally disables the normal procedures.
- + Added more checks on Undock/Belt swapping
- + Fixed a loop that could cause bot to get stuck in station after getting recalled by GCS
- + Added two example LUA scripts (not on by default) for autostacking and toggling MWD on asteroid approach.
LUA API Functions
ImagePresent: Check if image is present on screen.
String: image path
Float: tolerance
String: common name (can be empty)
Returns boolean
Code:
ImagePresent(string, float, string) --> bool
FindImage: Find image on screen and returns coordinates.
If the image is not found the return output will be -1, -1
String: image path
Float: tolerance
String: common name (can be empty)
Returns coordinate table. X is [1], Y is [2].
Code:
FindImage(string, float, string) --> List<int>
FindMulti: Find images on screen and returns coordinates.
If the image is not found the return output will be -1, -1
String: image path
Float: tolerance
Bool: convert to grayscale image
String: common name (can be empty)
Returns coordinate table. X is [n][1], Y is [n][2].
Code:
FindMulti(string, float, bool, string) --> List<List<int>>
SendTap: Taps at given coordinates.
Int: X coordinate
Int: Y coordinate
Returns integer (always 1)
Code:
SendTap(int, int) --> int
SendSwipe: Swipes at given coordinates.
Int: Start X coordinate
Int: Start Y coordinate
Int: End X coordinate
Int: End Y coordinate
Returns integer (always 1)
Code:
SendSwipe(int, int, int, int) --> int
LogEvent: Sends a log message to console.
String: The message
Returns integer (always 1)
Code:
LogEvent(string) -> int
Sleep: sleep the execution for the provided milliseconds.
Int: milliseconds to sleep (1000 = 1 second)
Returns integer (always 1)
CheckInSpace: checks if player is in space.
Returns boolean
Code:
CheckInSpace() --> Bool
OreHoldFull: checks ore hold is full.
Returns boolean
Code:
OreHoldFull() --> Bool
WarpAndDock: autopilot to station.
Returns boolean on completed operation.
Code:
WarpAndDock() --> Bool
SendWebhookMessage: send a message via Telegram or Discord webhook.
String: The message
Returns boolean on completed operation.
Code:
SendWebhookMessage(string) --> Bool
UploadScreengrab: capture and upload to Imgur a screengrab.
Returns the image link or the string "error" on a falied operation.
Code:
UploadScreengrab() --> string