Programmable Block Scripting in Space Engineers

You can add code to special blocks in Space Engineers to provide automation. Since the code is C#, it is much easier to do your coding in Visual Studio, before pasting it in to the in-game editor.

It’s fairly easy to do: Fire up Visual Studio, then create a C# console application. Add a reference in your project to <Space Engineers Install Directory>\Bin64\Sandbox.Common.dll, then add Sandbox.ModAPI.Ingame to your usings.

You can use this boilerplate (Source Reddit) to get started:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Sandbox.ModAPI.Ingame;

namespace SpaceEngineersScripting
    class CodeEditorEmulator
        IMyGridTerminalSystem GridTerminalSystem = null;

        #region CodeEditor
        void Main()

Everything in the between the CodeEditor #region tag is what you would paste in to the in-game editor.

Bear in mind that you can only use the properties and methods documented in the script editor help. For safety reasons, the in-game compiler will not blindly compile anything you throw at it.

There are also some bugs that they are working on: You can’t use foreach at the moment, and lambdas can’t be used.
Be sure to read the in-game documentation (click the help button at the top right of the editor).

1 Like