Skip to content

Quick start

InflexCZE edited this page May 9, 2021 · 25 revisions

Phenol is standalone visual scripting editor oriented specifically for Progammable Block scripts and Mods for Space Engineers sandbox game.
This guide will walk you through initial setup of the editor, scripting project and optionally setup of the game itself for easy deployment and debugging.

Get the Editor

Binaries of the latest Phenol editor are available on Releases page.
Simply download PhenolEditor.zip archive, extract it anywhere on your disk, locate PhenolEditor.exe and start it.
The editor should open. EmptyEditor

Note that Phenol requires Microsoft .NET Framework to run.
It usually comes preinstalled with the MS Windows operating system and it is also required by Space Engineers so you should already have it installed.
If not, you can download it from official source: https://dotnet.microsoft.com/download/dotnet-framework

My first script

In-game scripts, also known as programmable block scripts, are logic scripts of limited size usually leveraged for simple in-game automation and/or remote communication. These scripts can't break the rules of the game and can't perform any action that regular non-admin player could do in the game world.

While it is possible to setup new scripting project from scratch, there are no real benefits to that so it's recommended to use pre-configured example script for easy start. To do that, extract ExampleScript.zip package available from Releases page anywhere on your disk. In the Phenol editor press "Project" button, then "Open project" and finally point the editor to location of your project. The editor should load the project and will attempt to locate your SE installation to load game references (It will prompt you if it can't be found at usual locations). After that it should present you with single script class ExampleScript.Program that is in the project. Click on the class name to open Class editor.
Class Editor

In the Class editor you should see number of Methods defined in this class in the top left list as well as list of declared class constructors right bellow. Finally there is list of class variables at the bottom left. Double click any of the methods to populate central section of the editor with logic nodes of the given method. This is the actual script that will be executed.

At this point you can hit Compile button to translate the visual script into C# code that can be executed by the game and navigate to Compiled sub-folder in your project, the generated C# code should be there. Open it with any text editor, copy the entire file and paste (replace) it's content into Programmable block's field for program. This process will get much simpler if you also setup Space Link, more on that later.

Example script expects target grid to have set of lights to animate.
You can use Example Grid so you don't have to build it yourself.

Your result should look like this
ExampleScript

My first mod

Mods are more powerful compared to in-game scripts. Besides having access to all features of an in-game script, mods can also break and/or make new game rules as well as perform admin and other tasks that require elevated privileges. While modding featureset in SE is still somewhat limited, especially in terms of access to the core engine and host system, access to gameplay layer is almost unlimited and can be altered extensively.

While it is possible to setup new mod project from scratch, again, there are no benefits to that so it's recommended to use pre-configured example mod for easy start. To do that, extract ExampleMod.zip package available from Releases page to %appdata%\SpaceEngineers\Mods\ExampleMod.

Technically you can extract the project anywhere on your disk for development purposes, but %appdata% is the only place where the game looks for local mods so this location is not negotiable should you want to load the mod into the game.

Same as with the in-game script above, point Phenol editor to where you extracted the projects' ExampleMod.netpp, load it and open pre-defined ExampleMod.SensorLogic class. When you press Compile button this time editor will automatically translate the visual script into C# mod that can be executed by the game. Create new SE world, add ExampleMod into the active mod list and load the world.

Example mod makes all sensor blocks in the world set detected players' health based on value defined in sensors Custom Data field. You can build such sensor yourself or use Example Grid.

Your result should look like this
ExampleMod

Space Link

You may have noticed in the videos above that the editor is automatically visualizing current state of the script execution. This is possible thanks to Space Link. For easy deployment and debugging of in-game scripts as well as mods, please read dedicated Space Link chapter.

Clone this wiki locally