Thursday, June 25, 2015

Space Engineers - Step by step: Programmable Blocks

Hey, I'm gonna make some tutorials about a little bit more advanced stuff. This time, let's set up some programmable blocks. They're not difficult to use, yet some things have to be considered. Let's get through it step by step:





1. Build a Programmable Block
2. Build a Timer Block

Almost every program has to be executed on a regular bases, and the programmable block can only execute by getting a command to do so.

3. Click "Edit"
4. Click "Browse Workshop"
5. Click "Browse Workshop" again (Down right)

You can type your code directly into the edit button, but you obviously have to be able to program in order to do that. The coding language is C#. For us noobs, it's easier to just get some code, someone else set up for us.

6. Search for the script you want in the overlay workshop. Make sure you got the right type selected.
7. Subscribe to the script.
8. Leave the workshop and hit "Refresh Scripts"
9. Choose the script from the list and press ok.
10. Press check code. It'll lag a bit, then a window should pop up saying "Compilation successful"
11. Press remember and exit.

Now we got our code set. We only need to execute it. We can either do that by pressing "Run" on the control panel - that's how the code will be executed once - or we can set a timer, so the code will be run regularly and automatically. 

12. Go to the timer block in your control panel
13. Press "Setup actions"
14. Choose the timer block and set it to "start".

This is very important, so that the timer triggers itself. Otherwise, it would only run through the code one time, and stop then. With the action we've set, the timer reactivates itself.

15. Choose the Programmable Block and set it to "run".
16. Confirm without setting up some additional arguments.
17. Press "Trigger now" on the timer block.

Now you've set the most basic programmable blocks. Some code requires additional actions or blocks, which are mostly described on the mod pages. Just follow the instructions there. Since the codes are mostly made for English, it's not certain that every code will work with other language clients. 

Keep in mind, that every executed code takes resources. Don't program infinite loops, set larger code blocks on a more prolonged timer. You don't need to check your miner inventory every second. I got it to every 10 seconds.

Here some pictures to help clarifying the process: