Space Engineers Wiki

New Official Space Engineers wiki

A new official wiki is now available! - at https://spaceengineers.wiki.gg/

This wiki is deprecated in favour of it.

READ MORE

Space Engineers Wiki
Programmable Block

Category: Functional Block
Status: Functional

Function:
Executes Entered Code

Fits small ship
Mass: 138.4 kg
Power: -500 W

Fits large ship and station
Mass: 534.4 kg
Power: -500 W

Data Controls: [edit] [purge] (?)
Programmable-block-small

The small-grid variant of a PB looks like a wall-mounted laptop. Small battery in the background.

 Programmable Blocks (short: PB) can execute C# scripts to automatically perform a multitude of in-game functions. If a Timer Block or Sensor can't handle your task, a PB likely can. For a simpler , more user-friendly alternative, see also Event Controller.

You either subscribe to Scripts on the Workshop or write them yourself. The script can run in a loop or be triggered by a Sensor, Timer, Button, from the Toolbar, or by an Autopilot waypoint action.

The block’s secondary use is decorative.

Construction[]

You must build one Programmable block per script. They are cheap to build but take up 1x1x1 space, both on large and small grids. The large-grid block attaches to other blocks on the bottom side. It has one side with a decorative screen interface that you may want to keep accessible, but that's not a requirement. The small grid block attaches to blocks only on the backside. They are not airtight.

Visually the large grid block looks like a fridge-sized mainframe with a built-in LCD display and keyboard. The small-grid variant looks like a small wall-mounted tablet with a small keyboard hanging under it.

The LCD surfaces are configurable: Unless the script itself uses them to display its status, you can put any content on them, including built-in scripts or text or images.

You can also use PBs decoratively without loading an actual script, for example, if you put a chair in front of the large-grid variant, it looks like a workstation or bridge officer’s seat.

Requirements[]

Before you can use  Programmable Blocks, check the following requirements:

Important: Read up on the scripts that you subscribe to on the workshop, they come with instructions, such as, "edit certain lines in the script", "enter certain arguments", "rename certain blocks in the grid", or "enter certain keywords as custom data".

Warning : Many multiplayer server admins will punish or outright ban you for running performance-intensive scripts! Be considerate of the other players on the server when choosing scripts!

Possible Actions[]

For comparison, Timer Blocks can only switch other blocks on and off and increase and decrease specific overrides in fixed intervals - whereas PB scripts can set any attribute to any calculated value, for example, switch the light colour from white to red.

Sensors can only detect proximity — whereas PB scripts can read any state information of a grid and react to it: For example, content of inventories, wheel steering, damage state, position, ownership, ...

Event Controllers are between Timers/Sensors and PBs: They are easier to use than Scripts but only support a subset of script API functionalities.

In simpler use cases, you may use scripts to change light color settings in custom patterns, or maybe rotate solar arrays to align precisely with the sun. In advanced use cases, you may want to direct auto-mining drones, fly with vector-thrust, control wheel propulsion on subgrids, display the ship’s damage status on a floor plan, detail current power usage, auto-manage inventories or production, get a radar view of your interplanetary surroundings or a planetary map, activate timer blocks remotely, and much more…!

Tip: Go to the Steam Workshop and filter the search by “last year” and (important) select Type: InGameScript to browse fantastic scripts shared by the community!

Usage[]

Right-click (or press F while facing) the block’s interface in-world to interact with the block directly, or open the grid’s Terminal as usual.

  1. On the Control Panel Screen, click Edit to open the script editor. It will open with an empty default script that has basic hooks for you to fill in.
  2. Enter your script in one of these ways:
    • Either click Browse Scripts, select a subscribed script from the Workshop, then click Copy to Editor.
    • Or type the script manually, or paste it from your VisualStudio.
  3. If the description asks you to customise some lines, do that now.
  4. Click Check Code and a dialog will say "Compilation successful" (or give an error message about what you'll need to fix). Click OK.
  5. Click OK to save the script.
  6. If you are using a script that needs custom data: Click Custom Data and enter your values, click OK, then click Recompile.
  7. Optional: Enter an argument in the Argument field.
  8. Click Run to test it. You will see helpful info in the bottom right corner.

Some scripts run in a loop. For others, you must set up a trigger (button, sensor, timer) that executes the Run action.

Possible Triggers[]

There are many ways to start a script, some require you to build additional blocks on the grid. These triggers are not mutually exclusive, you can activate the same PB in many ways:

  • Run the script manually from the Control Panel Screen, or assign its Run action to a Toolbar slot.
  • Assign the PB’s run action to any Button Panel and have the players push the button when needed.
  • Set up a Sensor to trigger the PB’s Run action automatically every time when specific conditions are met, such as when a player or grid is in proximity.
  • If you want to run it together with other actions, set up a Timer Block to trigger the PB’s Run action automatically after a countdown.
  • If you have a drone or shuttle that is controlled by the Remote Control Autopilot, any waypoint can trigger the PB’s Run action.

Troubleshooting[]

  • If the Programmable Block editor appears stuck and you cannot close the window nor click any buttons, click both mouse buttons to get unstuck.[1]
  • If you don't see an Edit button, save and close the game, open its Advanced World Settings, and enable In-Game Scripts!
  • If you have made changes that affect the script, such as renaming blocks or changing custom data, click Recompile.

When you click Help inside the Code editor, it will open an old guide on Steam that has outdated screenshots — don't let that scare you off. Rather bookmark this newer guide: Quick Introduction to Space Engineers Ingame Scripts.

When NOT to use PBs?[]

  • A PB obviously only helps you accomplish your task if a C# script exists for the SE API that performs the tasks that you want. You or somebody must write the script, don’t expect the PB itself to help you with the programming.
  • If you want to steer a drone ship, consider first whether the standard Autopilot, Event Controller, or Automaton can do what you need, in a simpler way.
  • Scripts are very performance intensive because they loop faster than Timers. If millisecond speed and precise calculation and setting of values is not essential, PBs are overkill, use other less resource-heavy methods first.
  • On multiplayer servers, an admin may disallow the use of all/certain scripts, so don’t rely on them too much outside your singleplayer games.

Recipe[]

 Programmable Block
ComponentLarge Ship/Station
Required
Large Ship/Station
Optional
Small Ship
Required
Small Ship
Optional
 Computer22
 Display11
 Motor11
 Large Steel Tube22
 Construction Comp.42
 Steel Plate111011


Blocks

Functional Blocks

Cockpits & Control
 Cockpit,  Fighter Cockpit,  Control Station,  Flight Seat,  Helm,  Saddle Cockpit,  Saddle Cockpit Compact,  Cab Cockpit,  Buggy Cockpit,  Rover Cockpit,  Passenger Seat,  Control Panel,  Control Panel Pedestal,  Vertical Button Panel,  Sci-Fi One-Button Terminal,  Sci-Fi Four-Button Panel,  Sci-Fi Control Panel, ( Inset)  Button Panel,  Button Panel Pedestal,  Remote Control,  Custom Turret Controller

Automation
 Sensor,  Timer Block,  Programmable Block,  Event Controller,  Emotion Controller,  AI Basic,  AI Flight,  AI Defensive,  AI Offensive,  AI Recorder

Communication
 Antenna,  Beacon,  Round Beacon, ( Top Mounted)  Camera,  Laser Antenna,  LCD Panel,  Corner LCD,  Text Panel,  Wide LCD Panel,  Transparent LCD,  Sci-Fi LCD Panel,  Holo LCD,  Inset LCD Panel,  Sloped LCD Panel,  Curved LCD Panel,  Ore Detector,  Sound Block

Defense & Offense
 Decoy,  Gatling Gun,  Gatling Turret,  Interior Turret,  Rocket Turret,  Reloadable Rocket Launcher,  Rocket Launcher,  Artillery,  Autocannon,  Artillery Turret,  Autocannon Turret,  Railgun,  Assault Cannon,  Assault Cannon Turret,  Target Dummy,  Warhead,  Explosive Barrel

Power
 Battery,  Small Battery,  Large Reactor,  Small Reactor,  Solar Panel,  Colorable Solar Panel,  Hydrogen Engine,  Wind Turbine,  Twin-Blade Wind Turbine

Life Support
 Medical Room,  Corner Medical Room,  Survival Kit,  Cryo Chamber,  Inset Cryo Room,  Oxygen Farm,  Interior Light,  Offset Light,  Spotlight,  Offset Spotlight,  Inset Light,  Air Vent ( Full),  Air Vent Fan ( Full)

Mobility
 Gyroscope,  Atmospheric Thruster,  Ion Thruster,  Hydrogen Thruster,  Parachute Hatch,  (Short)  Wheel Suspension 1x1,  (Short)  Wheel Suspension 2x2,  (Short)  Wheel Suspension 3x3,  (Short)  Wheel Suspension 5x5,  Offroad Wheels

Mining & Manufacturing
 Basic Refinery,  Refinery,  Basic Assembler,  Assembler,  Drill,  Grinder Block,  Welder Block,  Projector,  O2/H2 Generator,  Oxygen Farm,  Yield Module,  Power Efficiency Module,  Speed Module

Storage
 Large Cargo Container,  Medium Cargo Container,  Small Cargo Container,  Oxygen Tank,  Hydrogen Tank,  Store,  Contracts Block

Inventory Management
 Connector,  Small Connector/Ejector,  Collector,  Conveyor Junction,  Conveyor Tube  (Reinforced),  Curved Conveyor Tube  (Reinforced),  Conveyor Tube T Junction  (Reinforced),  Conveyor Sorter;  Small Conveyor,  Small Conveyor Tube  (Reinforced),  Small Curved Conveyor Tube  (Reinforced),  Small Conveyor Tube T Junction  (Reinforced),  Small Conveyor Sorter;  Conveyor Frame,  Conveyor Converter

Mechanical Blocks & Gravity Control
 Advanced Rotor,  Rotor,  Piston,  Hinge,  Landing Gear,  Magnetic Plate,  Merge Block,  Artificial Mass,  Gravity Generator,  Spherical Gravity Generator,  Safe Zone


References[]