Programmable Block

From Space Engineers Wiki
Revision as of 12:34, 29 November 2015 by Sapphire (talk | contribs) (saved draft. Tons more to add)
Jump to: navigation, search


Programmable Block Icon.png
Large Ship Icon.png
Large Ship / Station
Programmable Block
 
Components
Required

 

 
 
1
 
 
Mass (kg):
0
 
Integrity:
0
 
Build time (seconds):
20
 
Active power consumption (MW):
0.0005
 
Dimensions (W x H x D):
1 x 1 x 1
Programmable Block Icon.png
Small Ship Icon.png
Small Ship
Programmable Block
 
Components
Required

 

 
 
1
 
 
Mass (kg):
0
 
Integrity:
0
 
Build time (seconds):
20
 
Active power consumption (MW):
0.0005
 
Dimensions (W x H x D):
1 x 1 x 1

Overview

A Programmable Block can be programmed to do different functions, like switching lights and controlling doors. It can also be used by entering the control panel in the Terminal. It has almost unlimited functionality.

Usage

Programmable Block scripts run in a single update (single frame) and any that take too long to complete are aborted. This means it is impossible for a single run of the script to 'wait' on any event. If you want your script to run when something happens, you need to either find a way of getting another block to trigger it at the right time (an 'interrupt-driven' approach via eg. a sensor block), or modify your script to check for a precondition and set up a timer to run it regularly (a 'polling' approach). Depending on what your script is doing, one approach may be the preferred or even the only way to do it.

  • Since Update 01.067 each programmable block has a maximum limit of 50,000 characters for any in-game script.

Media

Tips

Known Issues

  • Foreach not working at 64- bit: - Problem:

Currently using of foreach loop inside script will cause “bad program exception” at some configurations and prevent script from running. We are working of fixing this issue. Workaround: All our interfaces used in in-game scripting are using lists as collections. Please use For loop for iteration across these lists

  • Lambda functions not working - Problem:

Currently lambda functions are not supported, if you use them in script, exception will be thrown and script will not run. Workaround: Please use method instead of lambda function if possible.

  • User defined variables are not saved - Problem:

None of the user defined variables inside script are saved, therefore after loading game they are reset to their default values. Workaround: We added string variable called "Storage" that will be loaded and saved when the block is loaded and saved.


See Also

Programming

Update History