Quick Introduction to Space Engineers Ingame Scripts

From Space Engineers Wiki
Jump to navigation Jump to search

This is a simplistic attempt to explain the various parts of an ingame script and how it works. It is by no means a complete explanation. To get further help, I recommend connecting to Keen’s official Discord and asking in the #programmable-block channel. There’s usually plenty of people there to help you. I will be assuming that you’re familiar with the game itself, and how to use scripts, and how to load a script into a programmable block via the workshop button.

The Language

First of all: The programmable block uses the programming language C# in order to provide high-performance automation for your builds. Before continuing you should get a basic grasp of the language itself. There are several tutorials on the web dealing with this, including Microsoft’s own. You might be able to find some tutorials which are better at explaining than them though, they tend to be rather obtuse. In the following tutorials I will be assuming at least a basic grasp of C#. If you find I don’t explain some things well enough, please let me know - I might try to improve it.

Writing Your Script

While you can use the ingame editor, it’s not very good. Its purpose is really just to be a storage box for the code. A lot of people uses Visual Studio (you’re going to want the Community edition)- and here I’m obviously going to point out my own extension, MDK, which will help you set everything up for scripting with Visual Studio. There are other options though, other IDEs which works. Visual Studio Code is another more lightweight IDE (don’t get confused by the name, it’s quite different from Visual Studio). I will not be talking about how to set up any other IDE though, it’s beyond the scope of these tutorials. Others simply use a plain text editor like Notepad, but obviously that will give no help with the API. Personally I used Visual Studio for scripting long before I made my extension. It’s a professional IDE, and the Community edition is completely free and fully featured.

API Listing

You’ll find an autogenerated API listing here. This contains all types and members available to ingame scripting - with exception to the .NET types, because including those would have made the listing far too big. There will be links to Microsoft’s own documentation for those types where appropriate.



This tutorial was adapted from the original on Malware's MDK wiki, by the author.