Difference between revisions of "Programmable Block"

From Space Engineers Wiki
Jump to: navigation, search
m (Fix camera)
m (categories)
 
(24 intermediate revisions by 10 users not shown)
Line 1: Line 1:
{{itembox
+
{{SimpleItembox|Mod:Vanilla/CubeBlock/LargeProgrammableBlock|Size||Mass||Integrity||BuildTimeSeconds||IsAirTight||ResourceSinkGroup||PCU}}
| item = Programmable Block
+
{{SimpleItembox|Mod:Vanilla/CubeBlock/SmallProgrammableBlock|Size||Mass||Integrity||BuildTimeSeconds||IsAirTight||ResourceSinkGroup||PCU}}
| description = Block That Executes Code
+
{{CategorizeComponents|Mod:Vanilla/CubeBlock/LargeProgrammableBlock}}
| tool = no
 
| largeship = yes
 
| smallship = yes
 
| component = no
 
| rawmaterial = no
 
| material = no
 
  
| sbuildtime = Unknown
+
== Overview ==
| scomponentstructure = 2
+
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.
| scomponent1 = Steel Plate
 
| scomponent1amt = 2
 
| scomponent2 = Construction Component
 
| scomponent2amt = 2
 
| scomponent3 = Large Steel Tube
 
| scomponent3amt = 2
 
| scomponent4 = Motor
 
| scomponent4amt = 1
 
| scomponent5 = Computer
 
| scomponent5amt = 2
 
  
| lbuildtime = Unknown
+
== Usage ==
| lcomponentstructure = 2
+
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.
| lcomponent1 = Steel Plate
 
| lcomponent1amt = 21
 
| lcomponent2 = Construction Component
 
| lcomponent2amt = 4
 
| lcomponent3 = Large Steel Tube
 
| lcomponent3amt = 2
 
| lcomponent4 = Motor
 
| lcomponent4amt = 1
 
| lcomponent5 = Computer
 
| lcomponent5amt = 2
 
  
| version = 01.063
+
*Since [[Update_01.067#Hotfix_01.067.007|Update 01.067 Hotfix 007]] each programmable block has a maximum limit of '''100,000''' characters for any in-game script.
}}
 
  
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. One of the biggest problems is that variables are not saved between world exit and loading.
+
=== GUI Overview ===
  
== API List ==
+
The programmable block terminal panel screen currently contains two buttons:
  
This is a list of all API functions currently available<ref>http://steamcommunity.com/sharedfiles/filedetails/?id=360966557</ref>.
+
''Edit'' – it will open the editor for editing scripts and the ability to save/load scripts from and to disk.
 +
Also, you can upload your scripts to workshop and download subscribed scripts.
  
=== GridTerminalSystem ===
+
''Run'' – it will run the script that was remembered in editor. It will run the script only once. However this button is terminal action, so you can attach it to sensor, timer block, and button or add it to toolbar.
  
Currently only following “built-in” variable that user can use: GridTerminalSystem. This is entry point of entire grid terminal system.
+
[[File:Steamworkshop webupload previewfile 360966557 preview.jpg|500px]]
  
==== Properties ====
+
''Details section'' – In this area the script exception will be shown (if any will occur)
  
{| class="wikitable"
+
==== Editor ====
! Property
+
{| style="width: 80%;"
! Return Type
+
|
! Description
+
[[File:Steamworkshop webupload previewfile 360966557 preview (1).jpg|500px]]
! get
 
! set
 
|-
 
| Blocks
 
| List<IMyTerminalBlock>
 
| Returns a list of all blocks on the grid
 
| V
 
| X
 
|-
 
| BlockGroups
 
| List<IMyBlockGroup>
 
| Returns a list of all groups in the grid.
 
| V
 
| X
 
|}
 
  
==== Methods ====
+
|Code editor contains these buttons:
 
+
* ''Help'' – it will open the help guide inside the game.
{| class="wikitable"
+
* ''Check Code'' – it will check the code for code mistakes and also check if used code isn’t forbidden.
! Method
+
* ''Remember & Exit'' – it will save the code for execution, close editor screen and returns to terminal panel.
! Return Type
+
* ''Remember code'' – it will save code for execution and leave editor open.
! Description
+
* ''Browse Workshop'' – it will open a window for script management, you can save/load scripts from disk , upload scripts to workshop and download subscribed scripts.
|-
+
* ''Line counter'' – it shows current line number and total number of lines in code
| GetBlocksOfType<T>(List<IMyTerminalBlock> blocks, Func<IMyTerminalBlock, bool> collect = null)
 
| void
 
| Puts all found blocks of provided type in the list that are connected to the grid
 
|-
 
| SearchBlocksOfName(string name,List<IMyTerminalBlock> blocks, Func<IMyTerminalBlock, bool> collect = null)
 
| void
 
| Puts all found blocks of provided name in the list that are connected to the grid
 
|-
 
| GetBlockWithName(string name)
 
| IMyTerminalBlock
 
| Returns a block with provided name
 
 
|}
 
|}
 
+
==== Browse Workshop ====
=== IMyCubeBlock ===
+
{| style="width: 80%;"
 
+
|
IMyCubeBlock is base class for every terminal block.
+
[[File:Browse workshop.jpg|200px]]
 
+
|This screen is similar to blueprint screen and contains these buttons :
==== Properties ====
+
* ''Ok'' – it will load the selected script into the editor and close the screen
 
+
* ''Cancel'' – it will close the screen (no changes to code in editor)
{| class="wikitable"
+
* ''Details'' – it will open the "details" screen, where you can see description of script
! Property
+
* ''Rename (only for local scripts)'' – it will rename the selected script, if you try to rename to existing script, the game will ask you if you want to overwrite the existing script.
! Return Type
+
* ''Delete (only for local scripts)'' – it will ask you if you really want to delete the script, after the confirmation script will be deleted.
! Description
+
* ''Create from editor''– it will create new script with default name Script_XX it starts with 0 and if the script with the selected name already exists, it will increment the value. E.g. first there will be Script_0 then Script_1 etc…
! get
+
* ''Replace from editor (only for local scripts)'' – it will replace (after user confirmation) the selected script with script from the editor.
! set
+
* ''Refresh Scripts'' – will reload the local and subscribed script list
|-
 
| IsBeingHacked
 
| boolean
 
| Returns true if block is being hacked
 
| V
 
| X
 
|-
 
| IsFunctional
 
| boolean
 
| Returns true if current block is operational
 
| V
 
| X
 
|-
 
| IsWorking
 
| boolean
 
| Returns true if current block is powered
 
| V
 
| X
 
|-
 
| Position
 
| VRageMath.Vector3I
 
| Returns current position
 
| V
 
| X
 
 
|}
 
|}
 
+
==== Details (local script) ====
=== IMyTerminalBlock ===
+
{| style="width: 80%;"
 
+
|
MyTerminalBlock is base class for every terminal block.
+
[[File:Details (local script).jpg|500px]]
 
+
|This screen will show up when you press details for local script and contains the following buttons:
==== Properties ====
+
* ''Rename'' – it will rename the selected script, if you try to rename to existing script, the game will ask if you want to overwrite the existing script.
 
+
* ''Delete'' – it will ask you if you want to delete the script, after confirmation script will be deleted.
{| class="wikitable"
+
* ''Publish'' – it will publish the script into workshop and show the workshop page with the script.
! Property
+
* ''Browse Workshop'' – it will open the workshop screen to browse and subscribe scripts.
! Return Type
+
* ''Close'' – it will close the screen
! Description
 
! get
 
! set
 
|-
 
| CustomName
 
| String
 
| Returns name of the block
 
| V
 
| X
 
|-
 
| CustomNameWithFaction
 
| String
 
| ...
 
| V
 
| X
 
|-
 
| DetailedInfo
 
| String
 
| ...
 
| V
 
| X
 
|-
 
| ShowOnHUD
 
| boolean
 
| Whether block shows up on hud
 
| V
 
| X
 
 
|}
 
|}
 +
==== Details (workshop script) ====
  
==== Methods ====
+
This screen will show up when you press details for script from workshop and it contains these buttons:
 
+
* ''Open in Workshop'' – it will open the current script workshop page.
{| class="wikitable"
+
* ''Close'' – it will close the screen
! Method
 
! Return Type
 
! Description
 
|-
 
| HasLocalPlayerAccess()
 
| boolean
 
| ...
 
|-
 
| HasPlayerAccess(long playerId)
 
| boolean
 
| ...
 
|-
 
| RequestShowOnHUD(bool enable)
 
| void
 
| ...
 
|-
 
| SetCustomName(string text)
 
| void
 
| Set the name of the block
 
|-
 
| SetCustomName(StringBuilder text)
 
| void
 
| Set the name of the block
 
|-
 
| GetActions(List<ITerminalAction> resultList, Func<ITerminalAction, bool> collect = null)
 
| void
 
| Populates list with available actions
 
|-
 
| SearchActionsOfName(string name,List<ITerminalAction> resultList, Func<ITerminalAction, bool> collect = null)
 
| void
 
| Populates list with available actions matching the name (Case Insensitive)
 
|-
 
| GetActionWithName(string name)
 
| ITerminalAction
 
| Returns action with specified name (Case Sensitive)
 
|}
 
  
=== ITerminalAction ===
+
== Media ==
 +
[[File:Programmable_Block_ProgramBlock01.jpg|none|400px]]
  
ITerminal action is representation of concrete action that can be triggered.
+
== Tips ==
  
==== Properties ====
+
== 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. <br/>''Workaround'' - All our interfaces used in in-game scripting are using lists as collections. Please use For loop for iteration across these lists
  
{| class="wikitable"
+
*'''Lambda functions not working'''
! Property
+
''Problem'':
! Return Type
+
Currently lambda functions are not supported, if you use them in script, exception will be thrown and script will not run.<br/>''Workaround'' -
! Description
+
Please use method instead of lambda function if possible.
! get
 
! set
 
|-
 
| Id
 
| String
 
| Returns id of the action
 
| V
 
| X
 
|-
 
| Name
 
| StringBuilder
 
| Returns the name of the action
 
| V
 
| X
 
|}
 
  
==== Methods ====
+
* '''User defined static variables and methods not working'''
 +
''Problem'' -
 +
Currently using user defined static members or methods will cause script to throw exception and the script will not run.<br/>''Workaround'' -
 +
Please don’t define static methods or variables.
  
{| class="wikitable"
+
*'''User defined variables are not saved'''
! Method
+
''Problem'' -
! Return Type
+
None of the user defined variables inside script are saved, therefore after loading game they are reset to their default values.<br/>''Workaround'' -
! Description
+
We added string variable called "Storage" that will be loaded and saved when the block is loaded and saved.
|-
 
| Apply(IMyCubeBlock block)
 
| void
 
| Apply the action on a block
 
|}
 
  
=== IMyFunctionalBlock ===
+
== See Also ==
 +
* [[Programming Guide]]
 +
* [[Programming_Guide/Action_List|Action List]]
 +
* [[Programming_Guide/API_List|API List]]
  
IMyFunctionalBlock is base class for every block that can be turned on or off, it’s derived from IMyTerminal block e.g. every Functional block is Terminal block but not all terminal blocks can be turned on or off.
+
== Programming ==
 +
* [[Programming_Guide/Action_List#Programmable_block|Action List - Programmable block]]
  
==== Properties ====
+
== External links ==
 +
* Programmable block [https://github.com/malware-dev/MDK-SE/wiki/Quick-Introduction-to-Space-Engineers-Ingame-Scripts coding guide] - Malware's coding guide
  
{| class="wikitable"
+
== Update History ==
! Property
+
<div style="-webkit-border-image: none;-webkit-box-shadow: rgba(0, 0, 0, 0.046875) 0px 1px 1px 0px inset;background-color: #eeeeee;border-bottom-color: #AFAFAF;border-bottom-left-radius: 3px;border-bottom-right-radius: 3px;border-bottom-style: solid;border-bottom-width: 1px;border-left-color: #AFAFAF;border-left-style: solid;border-left-width: 1px;border-right-color: #AFAFAF;border-right-style: solid;border-right-width: 1px;border-top-color: #AFAFAF;border-top-left-radius: 3px;border-top-right-radius: 3px;border-top-style: solid;border-top-width: 1px;box-shadow: rgba(0, 0, 0, 0.046875) 0px 1px 1px 0px inset;color: #333;display: block;font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;font-size: 1em;height: auto;line-height: 20px;margin-bottom: 5px;margin-left: 8px;margin-right: 8px;margin-top: 0px;min-height: 20px;padding-bottom: 4px;padding-left: 4px;padding-right: 4px;padding-top: 4px;width: auto;">
! Return Type
+
{| class="wikitable" style="width: 100%"
! Description
+
|style="text-align: left;width: 8%"| [[Update 01.063]] ||style="padding-left: 10px;padding-right: 10px;"|
! get
+
* Programmable Block Introduced
! set
 
|-
 
| Enabled
 
| boolean
 
| Returns true if the block is turned on
 
| V
 
| X
 
 
|}
 
|}
  
== Action List ==
+
</div>
 
+
[[Category:Functional Blocks]]
All terminal blocks have the following properties:
 
Interface name: this name is the name of the block in code, it can differ from the name as displayed in the building screen. E.g. Antenna interface name is IMyRadioAntenna - you need to use this interface if you want to get all antennas.
 
 
 
'''Parent:''' this is parent of the block (all blocks have IMyTerminalBlock as parent), this can be used for getting type of blocks instead of concrete block type. E.g. if you want to get all lights in grid you will use IMyLightingBlock, if you want only interior light you can use IMyInteriorLight.
 
 
 
'''Field:''' this is read only field available for block e.g. for IMyBeacon you can get Radius property. Based on this property you can increase/decrease radius of beacon.
 
 
 
'''Actions:''' these are all available actions for block with their names in game, so if you want to increase broadcast radius for antenna, you need to execute DecreaseRadius action for block.
 
 
 
=== Antenna ===
 
 
 
'''Interface name:''' IMyRadioAntenna<br />
 
'''Parent:''' IMyFunctionalBlock<br />
 
'''Fields:''' float Radius
 
 
 
'''Actions'''
 
OnOff -> Toggle block On/Off<br />
 
OnOff_On -> Toggle block On<br />
 
OnOff_Off -> Toggle block Off<br />
 
IncreaseRadius -> Increase Broadcast radius<br />
 
DecreaseRadius -> Decrease Broadcast radius
 
 
 
=== Arc Furnace ===
 
 
 
'''Interface name:''' IMyRefinery<br />
 
'''Parent:''' IMyProductionBlock<br />
 
'''Parent:''' IMyFunctionalBlock<br />
 
'''Fields:'''  bool UseConveyorSystem
 
 
 
'''Actions'''
 
OnOff -> Toggle block On/Off<br />
 
OnOff_On -> Toggle block On<br />
 
OnOff_Off -> Toggle block Off<br />
 
UseConveyor -> Use Conveyor System On/Off
 
 
 
=== Artificial Mass ===
 
 
 
'''Interface name:''' IMyVirtualMass<br />
 
'''Parent:''' IMyFunctionalBlock<br />
 
'''Fields:'''  None
 
 
 
'''Actions'''
 
OnOff -> Toggle block On/Off<br />
 
OnOff_On -> Toggle block On<br />
 
OnOff_Off -> Toggle block Off
 
 
 
=== Assembler ===
 
 
 
'''Interface name:''' IMyAssembler<br />
 
'''Parent:''' IMyProductionBlock<br />
 
'''Parent:''' IMyFunctionalBlock<br />
 
'''Fields:'''  bool UseConveyorSystem
 
 
 
'''Actions'''
 
OnOff -> Toggle block On/Off<br />
 
OnOff_On -> Toggle block On<br />
 
OnOff_Off -> Toggle block Off<br />
 
UseConveyor -> Use Conveyor System On/Off
 
 
 
=== Battery ===
 
 
 
'''Interface name:''' IMyBatteryBlock<br />
 
'''Parent:''' IMyFunctionalBlock<br />
 
'''Fields:'''  bool HasCapacityRemaining
 
 
 
'''Actions'''
 
OnOff -> Toggle block On/Off<br />
 
OnOff_On -> Toggle block On<br />
 
OnOff_Off -> Toggle block Off<br />
 
Recharge -> Recharge On/Off
 
 
 
=== Beacon ===
 
 
 
'''Interface name:''' IMyBeacon<br />
 
'''Parent:''' IMyFunctionalBlock<br />
 
'''Fields:'''  float Radius
 
 
 
'''Actions'''
 
OnOff -> Toggle block On/Off<br />
 
OnOff_On -> Toggle block On<br />
 
OnOff_Off -> Toggle block Off<br />
 
IncreaseRadius -> Increase Broadcast radius<br />
 
DecreaseRadius -> Decrease Broadcast radius
 
 
 
=== Button Panel ===
 
 
 
'''Interface name:''' IMyButtonPanel<br />
 
'''Fields:'''  bool AnyoneCanUse
 
 
 
'''Actions'''
 
AnyoneCanUse -> Anyone Can Use On/Off
 
 
 
=== Camera ===
 
'''Interface name:''' IMyCameraBlock<br />
 
'''Parent:''' IMyFunctionalBlock<br />
 
'''Fields:'''  None
 
 
 
'''Actions'''
 
OnOff -> Toggle block On/Off<br />
 
OnOff_On -> Toggle block On<br />
 
OnOff_Off -> Toggle block Off<br />
 
View -> View
 
 
 
=== Cockpit ===
 
 
 
'''Interface name:''' IMyCockpit<br />
 
'''Parent:''' IMyShipController<br />
 
'''Fields:''' <br />
 
bool ControlWheels<br />
 
bool ControlThrusters<br />
 
bool HandBrake <br />
 
bool DampenersOverride
 
 
 
'''Actions'''
 
ControlThrusters -> Control thrusters On/Off<br />
 
ControlWheels -> Control wheels On/Off<br />
 
HandBrake -> Handbrake On/Off<br />
 
DampenersOverride -> Inertia dampeners On/Off
 
 
 
=== Collector ===
 
 
 
'''Interface name:''' IMyCollector<br />
 
'''Parent:''' IMyFunctionalBlock<br />
 
'''Fields:'''  bool UseConveyorSystem
 
 
 
'''Actions'''
 
OnOff -> Toggle block On/Off<br />
 
OnOff_On -> Toggle block On<br />
 
OnOff_Off -> Toggle block Off<br />
 
UseConveyor -> Use Conveyor System On/Off
 
 
 
=== Connector ===
 
 
 
'''Interface name:''' IMyShipConnector<br />
 
'''Parent:''' IMyFunctionalBlock<br />
 
'''Fields:''' <br />
 
bool ThrowOut <br />
 
bool CollectAll <br />
 
bool IsLocked
 
 
 
'''Actions'''
 
OnOff -> Toggle block On/Off<br />
 
OnOff_On -> Toggle block On<br />
 
OnOff_Off -> Toggle block Off<br />
 
ThrowOut -> Throw Out On/Off<br />
 
CollectAll -> Collect All On/Off<br />
 
SwitchLock -> Switch lock
 
 
 
=== Control Panel ===
 
 
 
'''Interface name:''' IMyControlPanel<br />
 
'''Fields:'''  None<br />
 
Actions: None
 
 
 
=== Control Station ===
 
 
 
'''Interface name:''' IMyCockpit<br />
 
'''Parent:''' IMyShipController<br />
 
'''Fields:''' <br />
 
bool ControlWheels<br />
 
bool ControlThrusters<br />
 
bool HandBrake <br />
 
bool DampenersOverride
 
 
 
'''Actions'''
 
ControlThrusters -> Control thrusters On/Off<br />
 
ControlWheels -> Control wheels On/Off<br />
 
HandBrake -> Handbrake On/Off<br />
 
DampenersOverride -> Inertia dampeners On/Off
 
 
 
=== Door ===
 
 
 
'''Interface name:''' IMyDoor<br />
 
'''Parent:''' IMyFunctionalBlock<br />
 
'''Fields:'''  bool Open
 
 
 
'''Actions'''
 
OnOff -> Toggle block On/Off<br />
 
OnOff_On -> Toggle block On<br />
 
OnOff_Off -> Toggle block Off<br />
 
Open -> Open/Closed<br />
 
Open_On -> Open<br />
 
Open_Off -> Closed
 
 
 
=== Drill ===
 
 
 
'''Interface name:''' IMyShipDrill<br />
 
'''Parent:''' IMyFunctionalBlock<br />
 
'''Fields:'''  bool UseConveyorSystem
 
 
 
'''Actions'''
 
OnOff -> Toggle block On/Off<br />
 
OnOff_On -> Toggle block On<br />
 
OnOff_Off -> Toggle block Off<br />
 
UseConveyor -> Use Conveyor System On/Off
 
 
 
=== Flight Seat ===
 
 
 
'''Interface name:''' IMyCockpit<br />
 
'''Parent:''' IMyShipController<br />
 
'''Fields:''' <br />
 
bool ControlWheels<br />
 
bool ControlThrusters<br />
 
bool HandBrake <br />
 
bool DampenersOverride
 
 
 
'''Actions'''
 
ControlThrusters -> Control thrusters On/Off<br />
 
ControlWheels -> Control wheels On/Off<br />
 
HandBrake -> Handbrake On/Off<br />
 
DampenersOverride -> Inertia dampeners On/Off
 
 
 
=== Gatling Turret ===
 
 
 
'''Interface name:''' IMyLargeGatlingTurret<br />
 
'''Parent:''' IMyLargeConveyorTurretBase<br />
 
'''Parent:''' IMyLargeTurretBase<br />
 
'''Parent:''' IMyFunctionalBlock<br />
 
'''Fields:''' <br />
 
bool UseConveyorSystem <br />
 
bool CanControl<br />
 
float Range
 
 
 
'''Actions'''
 
OnOff -> Toggle block On/Off<br />
 
OnOff_On -> Toggle block On<br />
 
OnOff_Off -> Toggle block Off<br />
 
Control -> Control<br />
 
IncreaseRange -> Increase Radius<br />
 
DecreaseRange -> Decrease Radius<br />
 
UseConveyor -> Use Conveyor System On/Off
 
 
 
=== Gravity Generator ===
 
 
 
'''Interface name:''' IMyGravityGenerator<br />
 
'''Parent:''' IMyGravityGeneratorBase<br />
 
'''Parent:''' IMyFunctionalBlock<br />
 
'''Fields:''' <br />
 
float FieldWidth <br />
 
float FieldHeight <br />
 
float FieldDepth <br />
 
float Gravity
 
 
 
'''Actions'''
 
OnOff -> Toggle block On/Off<br />
 
OnOff_On -> Toggle block On<br />
 
OnOff_Off -> Toggle block Off<br />
 
IncreaseWidth -> Increase Field width<br />
 
DecreaseWidth -> Decrease Field width<br />
 
IncreaseHeight -> Increase Field height<br />
 
DecreaseHeight -> Decrease Field height<br />
 
IncreaseDepth -> Increase Field depth<br />
 
DecreaseDepth -> Decrease Field depth<br />
 
IncreaseGravity -> Increase Acceleration<br />
 
DecreaseGravity -> Decrease Acceleration
 
 
 
=== Grinder ===
 
 
 
'''Interface name:''' IMyShipGrinder<br />
 
'''Parent:''' IMyShipToolBase<br />
 
'''Parent:''' IMyFunctionalBlock<br />
 
'''Fields:'''  None
 
 
 
'''Actions'''
 
OnOff -> Toggle block On/Off<br />
 
OnOff_On -> Toggle block On<br />
 
OnOff_Off -> Toggle block Off<br />
 
UseConveyor -> Use Conveyor System On/Off
 
 
 
=== Gyroscope ===
 
 
 
'''Interface name:''' IMyGyro<br />
 
'''Parent:''' IMyFunctionalBlock<br />
 
'''Fields:''' <br />
 
float GyroPower <br />
 
bool GyroOverride <br />
 
float Yaw <br />
 
float Pitch <br />
 
float Roll
 
 
 
'''Actions'''<br />
 
OnOff -> Toggle block On/Off<br />
 
OnOff_On -> Toggle block On<br />
 
OnOff_Off -> Toggle block Off<br />
 
IncreasePower -> Increase Power<br />
 
DecreasePower -> Decrease Power<br />
 
Override -> Override controls On/Off<br />
 
IncreaseYaw -> Increase Yaw override<br />
 
DecreaseYaw -> Decrease Yaw override<br />
 
IncreasePitch -> Increase Pitch override<br />
 
DecreasePitch -> Decrease Pitch override<br />
 
IncreaseRoll -> Increase Roll override<br />
 
DecreaseRoll -> Decrease Roll override
 
 
 
=== Interior Light ===
 
 
 
'''Interface name:''' IMyInteriorLight<br />
 
'''Parent:''' IMyLightingBlock<br />
 
'''Parent:''' IMyFunctionalBlock<br />
 
'''Fields:'''<br />
 
float Radius<br />
 
float Intensity<br />
 
float BlinkIntervalSeconds<br />
 
float BlinkLenght<br />
 
float BlinkOffset
 
 
 
'''Actions'''<br />
 
OnOff -> Toggle block On/Off<br />
 
OnOff_On -> Toggle block On<br />
 
OnOff_Off -> Toggle block Off<br />
 
IncreaseRadius -> Increase Radius<br />
 
DecreaseRadius -> Decrease Radius<br />
 
IncreaseBlink Interval -> Increase Blink Interval<br />
 
DecreaseBlink Interval -> Decrease Blink Interval<br />
 
IncreaseBlink Lenght -> Increase Blink Length<br />
 
DecreaseBlink Lenght -> Decrease Blink Length<br />
 
IncreaseBlink Offset -> Increase Blink Offset<br />
 
DecreaseBlink Offset -> Decrease Blink Offset
 
 
 
=== Interior Turret ===
 
 
 
'''Interface name:''' IMyLargeInteriorTurret<br />
 
'''Parent:''' IMyLargeTurretBase<br />
 
'''Parent:''' IMyFunctionalBlock<br />
 
'''Fields:'''<br />
 
bool CanControl<br />
 
float Range
 
 
 
'''Actions'''<br />
 
OnOff -> Toggle block On/Off<br />
 
OnOff_On -> Toggle block On<br />
 
OnOff_Off -> Toggle block Off<br />
 
Control -> Control<br />
 
IncreaseRange -> Increase Radius<br />
 
DecreaseRange -> Decrease Radius
 
 
 
=== Landing Gear ===
 
 
 
'''Interface name:''' IMyLandingGear<br />
 
'''Parent:''' IMyFunctionalBlock<br />
 
'''Fields:'''<br />
 
float BreakForce
 
 
 
'''Actions'''<br />
 
OnOff -> Toggle block On/Off<br />
 
OnOff_On -> Toggle block On<br />
 
OnOff_Off -> Toggle block Off<br />
 
Lock -> Lock<br />
 
Unlock -> Unlock<br />
 
SwitchLock -> Switch lock<br />
 
Autolock -> Autolock On/Off<br />
 
IncreaseBreakForce -> Increase Break Force<br />
 
DecreaseBreakForce -> Decrease Break Force
 
 
 
=== Small Cargo Container ===
 
 
 
'''Interface name:''' IMyCargoContainer<br />
 
'''Fields:''' None<br />
 
Actions: None
 
 
 
=== Medium Cargo Container ===
 
 
 
'''Interface name:''' IMyCargoContainer<br />
 
'''Fields:''' None<br />
 
Actions:None
 
 
 
=== Large Cargo Container ===
 
 
 
'''Interface name:''' IMyCargoContainer<br />
 
'''Fields:''' None<br />
 
Actions: None
 
 
 
=== Small Reactor ===
 
 
 
'''Interface name:''' IMyReactor<br />
 
'''Parent:''' IMyFunctionalBlock<br />
 
'''Fields:'''<br />
 
bool UseConveyorSystem
 
 
 
'''Actions'''<br />
 
OnOff -> Toggle block On/Off<br />
 
OnOff_On -> Toggle block On<br />
 
OnOff_Off -> Toggle block Off<br />
 
UseConveyor -> Use Conveyor System On/Off
 
 
 
=== Large Reactor ===
 
 
 
'''Interface name:''' IMyReactor<br />
 
'''Parent:''' IMyFunctionalBlock<br />
 
'''Fields:''' bool UseConveyorSystem
 
 
 
'''Actions'''<br />
 
OnOff -> Toggle block On/Off<br />
 
OnOff_On -> Toggle block On<br />
 
OnOff_Off -> Toggle block Off<br />
 
UseConveyor -> Use Conveyor System On/Off
 
 
 
=== Small Thruster ===
 
 
 
'''Interface name:''' IMyThrust<br />
 
'''Parent:''' IMyFunctionalBlock<br />
 
'''Fields:''' float ThrustOverride
 
 
 
'''Actions'''<br />
 
OnOff -> Toggle block On/Off<br />
 
OnOff_On -> Toggle block On<br />
 
OnOff_Off -> Toggle block Off<br />
 
IncreaseOverride -> Increase Thrust override<br />
 
DecreaseOverride -> Decrease Thrust override
 
 
 
=== Large Thruster ===
 
 
 
'''Interface name:''' IMyThrust<br />
 
'''Parent:''' IMyFunctionalBlock<br />
 
'''Fields:''' float ThrustOverride
 
 
 
'''Actions'''<br />
 
OnOff -> Toggle block On/Off<br />
 
OnOff_On -> Toggle block On<br />
 
OnOff_Off -> Toggle block Off<br />
 
IncreaseOverride -> Increase Thrust override<br />
 
DecreaseOverride -> Decrease Thrust override
 
 
 
=== Medical Room ===
 
 
 
'''Interface name:''' IMyMedicalRoom<br />
 
'''Parent:''' IMyFunctionalBlock<br />
 
'''Fields:''' None
 
 
 
'''Actions'''<br />
 
OnOff -> Toggle block On/Off<br />
 
OnOff_On -> Toggle block On<br />
 
OnOff_Off -> Toggle block Off
 
 
 
=== Merge Block ===
 
 
 
'''Interface name:''' IMyShipMergeBlock<br />
 
'''Parent:''' IMyFunctionalBlock<br />
 
'''Fields:''' None
 
 
 
'''Actions'''<br />
 
OnOff -> Toggle block On/Off<br />
 
OnOff_On -> Toggle block On<br />
 
OnOff_Off -> Toggle block Off
 
 
 
=== Missile Turret ===
 
 
 
'''Interface name:''' IMyLargeMissileTurret<br />
 
'''Parent:''' IMyLargeConveyorTurretBase<br />
 
'''Parent:''' IMyLargeTurretBase<br />
 
'''Parent:''' IMyFunctionalBlock<br />
 
'''Fields:'''<br />
 
bool UseConveyorSystem <br />
 
bool CanControl<br />
 
float Range
 
 
 
'''Actions'''<br />
 
OnOff -> Toggle block On/Off<br />
 
OnOff_On -> Toggle block On<br />
 
OnOff_Off -> Toggle block Off<br />
 
Control -> Control<br />
 
IncreaseRange -> Increase Radius<br />
 
DecreaseRange -> Decrease Radius<br />
 
UseConveyor -> Use Conveyor System On/Of
 
<br />
 
Ore Detector<br />
 
Interace name: IMyOreDetector<br />
 
'''Parent:''' IMyFunctionalBlock<br />
 
'''Fields:'''<br />
 
float Range <br />
 
bool BroadcastUsingAntennas
 
 
 
'''Actions'''<br />
 
OnOff -> Toggle block On/Off<br />
 
OnOff_On -> Toggle block On<br />
 
OnOff_Off -> Toggle block Off
 
 
 
=== Passenger Seat ===
 
 
 
'''Interface name:''' IMyCockpit<br />
 
'''Parent:''' IMyShipController<br />
 
'''Fields:'''<br />
 
bool ControlWheels<br />
 
bool ControlThrusters<br />
 
bool HandBrake <br />
 
bool DampenersOverride
 
 
 
'''Actions'''<br />
 
ControlThrusters -> Control thrusters On/Off<br />
 
ControlWheels -> Control wheels On/Off<br />
 
HandBrake -> Handbrake On/Off<br />
 
DampenersOverride -> Inertia dampeners On/Off
 
 
 
=== Piston ===
 
 
 
'''Interface name:''' IMyPistonBase<br />
 
'''Parent:''' IMyFunctionalBlock<br />
 
'''Fields:'''<br />
 
float Velocity <br />
 
float MinLimit <br />
 
float MaxLimit
 
 
 
'''Actions'''<br />
 
OnOff -> Toggle block On/Off<br />
 
OnOff_On -> Toggle block On<br />
 
OnOff_Off -> Toggle block Off<br />
 
Reverse -> Reverse<br />
 
IncreaseVelocity -> Increase Velocity<br />
 
DecreaseVelocity -> Decrease Velocity<br />
 
ResetVelocity -> Reset Velocity<br />
 
IncreaseUpperLimit -> Increase Maximal distance<br />
 
DecreaseUpperLimit -> Decrease Maximal distance<br />
 
IncreaseLowerLimit -> Increase Minimal distance<br />
 
DecreaseLowerLimit -> Decrease Minimal distance
 
 
 
=== Programmable block ===
 
 
 
'''Interface name:''' IMyProgrammableBlock<br />
 
'''Parent:''' IMyFunctionalBlock<br />
 
'''Fields:''' bool IsRunning
 
 
 
'''Actions'''<br />
 
OnOff -> Toggle block On/Off<br />
 
OnOff_On -> Toggle block On<br />
 
OnOff_Off -> Toggle block Off<br />
 
Run -> Run
 
 
 
=== Refinery ===
 
 
 
'''Interface name:''' IMyRefinery<br />
 
'''Parent:''' IMyFunctionalBlock<br />
 
'''Parent:''' IMyProductionBlock<br />
 
'''Fields:''' bool UseConveyorSystem
 
 
 
'''Actions'''<br />
 
OnOff -> Toggle block On/Off<br />
 
OnOff_On -> Toggle block On<br />
 
OnOff_Off -> Toggle block Off<br />
 
UseConveyor -> Use Conveyor System On/Off
 
 
 
=== Spotlight ===
 
 
 
'''Interface name:''' IMyReflectorLight<br />
 
'''Parent:''' IMyLightingBlock<br />
 
'''Parent:''' IMyFunctionalBlock<br />
 
'''Fields:'''<br />
 
float Radius<br />
 
float Intensity<br />
 
float BlinkIntervalSeconds<br />
 
float BlinkLenght<br />
 
float BlinkOffset
 
 
 
'''Actions'''<br />
 
OnOff -> Toggle block On/Off<br />
 
OnOff_On -> Toggle block On<br />
 
OnOff_Off -> Toggle block Off<br />
 
IncreaseRadius -> Increase Radius<br />
 
DecreaseRadius -> Decrease Radius<br />
 
IncreaseBlink Interval -> Increase Blink Interval<br />
 
DecreaseBlink Interval -> Decrease Blink Interval<br />
 
IncreaseBlink Lenght -> Increase Blink Length<br />
 
DecreaseBlink Lenght -> Decrease Blink Length<br />
 
IncreaseBlink Offset -> Increase Blink Offset<br />
 
DecreaseBlink Offset -> Decrease Blink Offset
 
 
 
=== Remote Control ===
 
 
 
'''Interface name:''' IMyRemoteControl<br />
 
'''Parent:''' IMyShipController<br />
 
'''Fields:'''<br />
 
bool ControlWheels<br />
 
bool ControlThrusters<br />
 
bool HandBrake <br />
 
bool DampenersOverride
 
 
 
'''Actions'''<br />
 
ControlThrusters -> Control thrusters On/Off<br />
 
ControlWheels -> Control wheels On/Off<br />
 
HandBrake -> Handbrake On/Off<br />
 
DampenersOverride -> Inertia dampeners On/Off<br />
 
Control -> Control
 
 
 
=== Rocket Launcher ===
 
 
 
'''Interface name:''' IMySmallMissileLauncher<br />
 
'''Parent:''' IMyFunctionalBlock<br />
 
'''Fields:''' bool UseConveyorSystem
 
 
 
'''Actions'''<br />
 
OnOff -> Toggle block On/Off<br />
 
OnOff_On -> Toggle block On<br />
 
OnOff_Off -> Toggle block Off<br />
 
UseConveyor -> Use Conveyor System On/Off
 
 
 
=== Reloadable Rocket Launcher ===
 
 
 
'''Interface name:''' IMySmallMissileLauncherReload<br />
 
'''Parent:''' IMyFunctionalBlock<br />
 
'''Fields:''' bool UseConveyorSystem
 
 
 
'''Actions'''<br />
 
OnOff -> Toggle block On/Off<br />
 
OnOff_On -> Toggle block On<br />
 
OnOff_Off -> Toggle block Off<br />
 
UseConveyor -> Use Conveyor System On/Off
 
 
 
=== Rotor ===
 
 
 
'''Interface name:''' IMyMotorStator<br />
 
'''Parent:''' IMyMotorBase<br />
 
'''Parent:''' IMyFunctionalBlock<br />
 
'''Fields:'''<br />
 
bool IsAttached <br />
 
float Torque<br />
 
float BrakingTorque <br />
 
float Velocity <br />
 
float LowerLimit <br />
 
float UpperLimit <br />
 
float Displacement
 
 
 
'''Actions'''<br />
 
OnOff -> Toggle block On/Off<br />
 
OnOff_On -> Toggle block On<br />
 
OnOff_Off -> Toggle block Off<br />
 
Reverse -> Reverse<br />
 
Detach -> Detach<br />
 
Attach -> Attach<br />
 
IncreaseTorque -> Increase Torque<br />
 
DecreaseTorque -> Decrease Torque<br />
 
IncreaseBrakingTorque -> Increase Braking tor.<br />
 
DecreaseBrakingTorque -> Decrease Braking tor.<br />
 
IncreaseVelocity -> Increase Velocity<br />
 
DecreaseVelocity -> Decrease Velocity<br />
 
ResetVelocity -> Reset Velocity<br />
 
IncreaseLowerLimit -> Increase Lower limit<br />
 
DecreaseLowerLimit -> Decrease Lower limit<br />
 
IncreaseUpperLimit -> Increase Upper limit<br />
 
DecreaseUpperLimit -> Decrease Upper limit<br />
 
IncreaseDisplacement -> Increase Rotor displacement<br />
 
DecreaseDisplacement -> Decrease Rotor displacement
 
 
 
=== Sensor ===
 
 
 
'''Interface name:''' IMySensorBlock<br />
 
'''Parent:''' IMyFunctionalBlock<br />
 
'''Fields:'''<br />
 
float LeftExtend <br />
 
float RightExtend <br />
 
float TopExtend <br />
 
float BottomExtend <br />
 
float FrontExtend <br />
 
float BackExtend <br />
 
bool DetectPlayers <br />
 
bool DetectFloatingObjects <br />
 
bool DetectSmallShips <br />
 
bool DetectLargeShips <br />
 
bool DetectStations <br />
 
bool DetectAsteroids
 
 
 
'''Actions'''<br />
 
OnOff -> Toggle block On/Off<br />
 
OnOff_On -> Toggle block On<br />
 
OnOff_Off -> Toggle block Off<br />
 
IncreaseLeft -> Increase Left extent<br />
 
DecreaseLeft -> Decrease Left extent<br />
 
IncreaseRight -> Increase Right extent<br />
 
DecreaseRight -> Decrease Right extent<br />
 
IncreaseBottom -> Increase Bottom extent<br />
 
DecreaseBottom -> Decrease Bottom extent<br />
 
IncreaseTop -> Increase Top extent<br />
 
DecreaseTop -> Decrease Top extent<br />
 
IncreaseBack -> Increase Back extent<br />
 
DecreaseBack -> Decrease Back extent<br />
 
IncreaseFront -> Increase Front extent<br />
 
DecreaseFront -> Decrease Front extent<br />
 
Detect Players -> Detect players On/Off<br />
 
Detect Floating Objects -> Detect floating objects On/Off<br />
 
Detect Small Ships -> Detect small ships On/Off<br />
 
Detect Large Ships -> Detect large ships On/Off<br />
 
Detect Stations -> Detect stations On/Off<br />
 
Detect Asteroids -> Detect Asteroids On/Off
 
 
 
=== Solar Panel ===
 
 
 
'''Interface name:''' IMySolarPanel<br />
 
'''Fields:'''None<br />
 
Actions:None
 
 
 
=== Sound Block ===
 
 
 
'''Interface name:''' IMySoundBlock<br />
 
'''Parent:''' IMyFunctionalBlock<br />
 
'''Fields:'''<br />
 
float Volume <br />
 
float Range <br />
 
bool IsSoundSelected<br />
 
float LoopPeriod
 
 
 
'''Actions'''<br />
 
OnOff -> Toggle block On/Off<br />
 
OnOff_On -> Toggle block On<br />
 
OnOff_Off -> Toggle block Off<br />
 
IncreaseVolumeSlider -> Increase Volume<br />
 
DecreaseVolumeSlider -> Decrease Volume<br />
 
IncreaseRangeSlider -> Increase Range<br />
 
DecreaseRangeSlider -> Decrease Range<br />
 
PlaySound -> Play<br />
 
StopSound -> Stop<br />
 
IncreaseLoopableSlider -> Increase Loop time<br />
 
DecreaseLoopableSlider -> Decrease Loop time
 
 
 
=== Spherical Gravity Generator ===
 
 
 
'''Interface name:''' IMyGravityGeneratorSphere<br />
 
'''Parent:''' IMyGravityGeneratorBase<br />
 
'''Parent:''' IMyFunctionalBlock<br />
 
'''Fields:'''<br />
 
float Radius <br />
 
float Gravity
 
 
 
'''Actions'''<br />
 
OnOff -> Toggle block On/Off<br />
 
OnOff_On -> Toggle block On<br />
 
OnOff_Off -> Toggle block Off<br />
 
IncreaseRadius -> Increase Radius<br />
 
DecreaseRadius -> Decrease Radius<br />
 
IncreaseGravity -> Increase Acceleration<br />
 
DecreaseGravity -> Decrease Acceleration
 
 
 
=== Timer Block ===
 
 
 
'''Interface name:''' IMyTimerBlock<br />
 
'''Parent:''' IMyFunctionalBlock<br />
 
'''Fields:'''<br />
 
bool IsCountingDown <br />
 
float TriggerDelay
 
 
 
'''Actions'''<br />
 
OnOff -> Toggle block On/Off<br />
 
OnOff_On -> Toggle block On<br />
 
OnOff_Off -> Toggle block Off<br />
 
IncreaseTriggerDelay -> Increase Delay<br />
 
DecreaseTriggerDelay -> Decrease Delay<br />
 
TriggerNow -> Trigger now<br />
 
Start -> Start<br />
 
Stop -> Stop
 
 
 
=== Warhead ===
 
 
 
'''Interface name:''' IMyWarhead<br />
 
'''Fields:'''<br />
 
bool IsCountingDown <br />
 
float DetonationTime
 
 
 
'''Actions'''<br />
 
IncreaseDetonationTime -> Increase Detonation time<br />
 
DecreaseDetonationTime -> Decrease Detonation time<br />
 
StartCountdown -> Start countdown<br />
 
StopCountdown -> Stop countdown<br />
 
Safety -> Safety On/Off<br />
 
Detonate -> Detonate
 
 
 
=== Welder ===
 
 
 
'''Interface name:''' IMyShipWelder<br />
 
'''Parent:''' IMyShipToolBase<br />
 
'''Parent:''' IMyFunctionalBlock
 
 
 
'''Actions'''<br />
 
OnOff -> Toggle block On/Off<br />
 
OnOff_On -> Toggle block On<br />
 
OnOff_Off -> Toggle block Off<br />
 
UseConveyor -> Use Conveyor System On/Off
 
 
 
=== Wheel Suspension 1x1 ===
 
 
 
'''Interface name:''' IMyMotorSuspension<br />
 
'''Parent:''' IMyMotorBase<br />
 
'''Parent:''' IMyFunctionalBlock<br />
 
'''Fields:'''<br />
 
bool Steering <br />
 
bool Propulsion <br />
 
float Damping <br />
 
float Strength <br />
 
float Friction <br />
 
float Power
 
 
 
'''Actions'''<br />
 
OnOff -> Toggle block On/Off<br />
 
OnOff_On -> Toggle block On<br />
 
OnOff_Off -> Toggle block Off<br />
 
Steering -> Steering On/Off<br />
 
Propulsion -> Propulsion On/Off<br />
 
IncreaseDamping -> Increase Damping<br />
 
DecreaseDamping -> Decrease Damping<br />
 
IncreaseStrength -> Increase Strength<br />
 
DecreaseStrength -> Decrease Strength<br />
 
IncreaseFriction -> Increase Friction<br />
 
DecreaseFriction -> Decrease Friction<br />
 
IncreasePower -> Increase Power<br />
 
DecreasePower -> Decrease Power
 
 
 
=== Wheel Suspension 3x3 ===
 
 
 
'''Interface name:''' IMyMotorSuspension<br />
 
'''Parent:''' IMyMotorBase<br />
 
'''Parent:''' IMyFunctionalBlock<br />
 
'''Fields:'''<br />
 
bool Steering <br />
 
bool Propulsion <br />
 
float Damping <br />
 
float Strength <br />
 
float Friction <br />
 
float Power
 
 
 
'''Actions'''<br />
 
OnOff -> Toggle block On/Off<br />
 
OnOff_On -> Toggle block On<br />
 
OnOff_Off -> Toggle block Off<br />
 
Steering -> Steering On/Off<br />
 
Propulsion -> Propulsion On/Off<br />
 
IncreaseDamping -> Increase Damping<br />
 
DecreaseDamping -> Decrease Damping<br />
 
IncreaseStrength -> Increase Strength<br />
 
DecreaseStrength -> Decrease Strength<br />
 
IncreaseFriction -> Increase Friction<br />
 
DecreaseFriction -> Decrease Friction<br />
 
IncreasePower -> Increase Power<br />
 
DecreasePower -> Decrease Power
 
 
 
=== Wheel Suspension 5x5 ===
 
 
 
'''Interface name:''' IMyMotorSuspension<br />
 
'''Parent:''' IMyMotorBase<br />
 
'''Parent:''' IMyFunctionalBlock<br />
 
'''Fields:'''<br />
 
bool Steering <br />
 
bool Propulsion <br />
 
float Damping <br />
 
float Strength <br />
 
float Friction <br />
 
float Power
 
 
 
'''Actions'''<br />
 
OnOff -> Toggle block On/Off<br />
 
OnOff_On -> Toggle block On<br />
 
OnOff_Off -> Toggle block Off<br />
 
Steering -> Steering On/Off<br />
 
Propulsion -> Propulsion On/Off<br />
 
IncreaseDamping -> Increase Damping<br />
 
DecreaseDamping -> Decrease Damping<br />
 
IncreaseStrength -> Increase Strength<br />
 
DecreaseStrength -> Decrease Strength<br />
 
IncreaseFriction -> Increase Friction<br />
 
DecreaseFriction -> Decrease Friction<br />
 
IncreasePower -> Increase Power<br />
 
DecreasePower -> Decrease Power
 
 
 
<references />
 

Latest revision as of 22:37, 18 May 2020

Programmable Block Icon.png
Large Ship / Station
Programmable block
Large Ship Icon.png

ComponentsRequired

 Functional 

 Hack 

Dimensions (W,H,L)1,1,1
Mass534.4 kg
534,400 g
534,400,000 mg
0.534 t
Integrity2,387
Build time20 s
Is AirtightNo
Power Consumer GroupUtility
PCU Cost100
BrowseLast edit: 2020-04-13
Programmable Block Icon.png
Small Ship
Programmable block
Small Ship Icon.png

ComponentsRequired

 Functional 

 Hack 

Dimensions (W,H,L)1,1,1
Mass138.4 kg
138,400 g
138,400,000 mg
0.138 t
Integrity427
Build time8 s
Is AirtightNo
Power Consumer GroupUtility
PCU Cost100
BrowseLast edit: 2020-04-13

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 Hotfix 007 each programmable block has a maximum limit of 100,000 characters for any in-game script.

GUI Overview

The programmable block terminal panel screen currently contains two buttons:

Edit – it will open the editor for editing scripts and the ability to save/load scripts from and to disk. Also, you can upload your scripts to workshop and download subscribed scripts.

Run – it will run the script that was remembered in editor. It will run the script only once. However this button is terminal action, so you can attach it to sensor, timer block, and button or add it to toolbar.

Steamworkshop webupload previewfile 360966557 preview.jpg

Details section – In this area the script exception will be shown (if any will occur)

Editor

Steamworkshop webupload previewfile 360966557 preview (1).jpg

Code editor contains these buttons:
  • Help – it will open the help guide inside the game.
  • Check Code – it will check the code for code mistakes and also check if used code isn’t forbidden.
  • Remember & Exit – it will save the code for execution, close editor screen and returns to terminal panel.
  • Remember code – it will save code for execution and leave editor open.
  • Browse Workshop – it will open a window for script management, you can save/load scripts from disk , upload scripts to workshop and download subscribed scripts.
  • Line counter – it shows current line number and total number of lines in code

Browse Workshop

Browse workshop.jpg

This screen is similar to blueprint screen and contains these buttons :
  • Ok – it will load the selected script into the editor and close the screen
  • Cancel – it will close the screen (no changes to code in editor)
  • Details – it will open the "details" screen, where you can see description of script
  • Rename (only for local scripts) – it will rename the selected script, if you try to rename to existing script, the game will ask you if you want to overwrite the existing script.
  • Delete (only for local scripts) – it will ask you if you really want to delete the script, after the confirmation script will be deleted.
  • Create from editor– it will create new script with default name Script_XX it starts with 0 and if the script with the selected name already exists, it will increment the value. E.g. first there will be Script_0 then Script_1 etc…
  • Replace from editor (only for local scripts) – it will replace (after user confirmation) the selected script with script from the editor.
  • Refresh Scripts – will reload the local and subscribed script list

Details (local script)

Details (local script).jpg

This screen will show up when you press details for local script and contains the following buttons:
  • Rename – it will rename the selected script, if you try to rename to existing script, the game will ask if you want to overwrite the existing script.
  • Delete – it will ask you if you want to delete the script, after confirmation script will be deleted.
  • Publish – it will publish the script into workshop and show the workshop page with the script.
  • Browse Workshop – it will open the workshop screen to browse and subscribe scripts.
  • Close – it will close the screen

Details (workshop script)

This screen will show up when you press details for script from workshop and it contains these buttons:

  • Open in Workshop – it will open the current script workshop page.
  • Close – it will close the screen

Media

Programmable Block ProgramBlock01.jpg

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 static variables and methods not working

Problem - Currently using user defined static members or methods will cause script to throw exception and the script will not run.
Workaround - Please don’t define static methods or variables.

  • 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

External links

Update History

Update 01.063
  • Programmable Block Introduced