Merlin of Mines - Space Engineers

A set of useful scripts for aspiring Space Engineers!

View on GitHub

Debugging Your Script

Rarely will you get your script perfect the first time you write it. Some errors are obvious, given a hint at where the problem is at.

Others take a bit more investigation to understand what’s going wrong.

Dealing with Parsing Issues

The first error you’ll likely encounter is a parsing issue, meaning EasyCommands can’t parse your script.

Your script may not parse for a variety of issues. When your script can’t be parsed, EasyCommands will halt the script and tell you what line number cannot be parsed.

Lines start at 1, so just count down from the top the number of lines until you find the error. Also feel free to copy/paste into a text editor to quickly find the line number, for longer scripts.

Isolating the broken lines

If your script is having trouble parsing a particular line or lines, try commenting out everything else (or save a copy and then delete it). This will help you get to the root cause more quickly.

Wrapping with Parentheses

Most things in EasyCommands can be wrapped with parentheses. If the way your commands are parsed might be ambiguous, try wrapping specific pieces with parentheses to help EasyCommands parse correctly.

Common Mistakes

Dealing With Execution Issues

Sometimes your script will parse just fine but then will error out during execution

Script Too Complex

If you receive the “script too complex” issue, a couple things might be happening.

Most likely, your script is trying to do too many things in a single tick. To fix this, break up your script into pieces.

The easiest way is to add a wait command. This will pause the script for 1 tick, and continue executing on the next tick.

Another possibility is that you are trying to call a function from within itself, or you have a chain of functions calling each other in a cycle.

Common Mistakes

Common debugging steps

Pausing/Slowing Down Script Execution

Sometimes your program may run too fast to see what’s happening effectively.

There are a couple things you can do to slow down execution and see what’s happening.

First, you can use the “Pause” command anywhere to pause the script. This will pause the script in its exact state, and will pick up where you left off when you run the program again (without an argument) hitting “run”. In this way, you can pause execution at a given moment, maybe right after you print some output to the screen.

You can also set the Runtime Frequency of the script manually. “Edit” the program and change execution to your desired frequency:

public UpdateFrequency updateFrequency = UpdateFrequency.Update10;

Supported Values: