Space Engineers

Space Engineers

View Stats:
Psyco Jun 25, 2024 @ 11:52am
Programmable block scripting documentation
Hi All,

About 2 days ago I got the urge to start writing scripts, however I see a lot of people complaining about incomplete/out of date documentation and fiddling around in the little spare time I have I ran into a lot of issues where the methods seem to be right but I still get errors saying definitions aren't contained. (small stuff like increasing a piston upper limit).

I am currently just raw writing it in the game editor, but seems like I need to turn to the "Malware" scripting library for visual studio.

Before I go down that path, I would like to know if anyone know of any up to date documentation with the complete methods and properties?

Additionally, if somebody can verify if the vs library is worth the hassle.

Thanks in advance.
(If someone replies, expect a day or 2 before I reply)
Originally posted by Jack Schitt:
I recently found this[spaceengineers.wiki.gg]. I didn't know it existed before finding it, no one has mentioned it before (that I saw) and it looks to have some useful info, some of which is a copy of what Malware published. I've also compiled modding links in this topic to try and help anyone that might be interested. You may or may not have seen that topic and may or may not have found those links already. Scripting links are at the bottom of that topic if you haven't already seen it.
< >
Showing 1-5 of 5 comments
A player by the name of "Malware" maintains a repository on GitHub. It has just about everything you're going to want to know about the MOD API including scripting.
https://github.com/malware-dev/MDK-SE/wiki/Api-Index
ShadedMJ Jun 25, 2024 @ 2:05pm 
I use Visual Studio linked to the Space Engineers libraries. I start typing and it will pretty much supply what it thinks I will type next. I like it. I make a variable of a piston, type the variable name with a period and get a list of things I can set like .MaxLimit

The errors I see most often are for displays and still using .WritePublicText and .WritePrivateText when that was replaced with .WriteText years ago.
The author of this thread has indicated that this post answers the original topic.
Jack Schitt Jun 25, 2024 @ 2:17pm 
I recently found this[spaceengineers.wiki.gg]. I didn't know it existed before finding it, no one has mentioned it before (that I saw) and it looks to have some useful info, some of which is a copy of what Malware published. I've also compiled modding links in this topic to try and help anyone that might be interested. You may or may not have seen that topic and may or may not have found those links already. Scripting links are at the bottom of that topic if you haven't already seen it.
Psyco Jun 30, 2024 @ 10:29pm 
Thank you all for the feedback. Using the documentation that Jack provided and implementing the MDK-SE extension for visual studio, I managed to create my script during the weekend.

For any new script writers reading this in the future. I had an issue where I tried directly referencing the properties of the blocks like "piston.Reverse()" => (this works (As it is a method but I tried doing it to properties)). But for getting and setting the max limit I tried "piston.UpperLimit = 9". (Using the https://spaceengineerswiki.com/Programming_Guide/Action_List#Piston as reference)

But to access the properties of most blocks you will need to get or set the values using block.getValue<type>("property name") and block.setValue<type>("property name", new value).

piston.setValue<float>("UpperLimit", 5f).

Its a lot of fiddle and figure out as you go. But for basic stuff thats almost all you need. There are some exceptions to this like piston.CurrentPosition and rotor.Angle that you can Access straight.

Okay thanks again you 3 that replied. It helped a lot.
Cheers!
Psyco Jul 1, 2024 @ 5:14am 
Cool good to know. I'll fiddle a bit more when I optimize my current one or create new ones. It'll definitely make it easier.
< >
Showing 1-5 of 5 comments
Per page: 1530 50

Date Posted: Jun 25, 2024 @ 11:52am
Posts: 5