Space Engineers

Space Engineers

Not enough ratings
State Machine Automation Script
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
748.655 KB
13 Jun @ 11:47am
5 Jul @ 6:33am
8 Change Notes ( view )

Subscribe to download
State Machine Automation Script

Description
This script is used to perform automation of your builds with a single configurable programmable block instead of using a series of event controllers and timer blocks.

It doesn't require you to code C#. Instead, you define a state machine and the transitions using the Custom Data field.

I uploaded a small test world to explore the script.

There is a guide that describes how to use the script.

What's next

I got the script to where I needed it at the moment to be able to automate the parking arm in my current game without the use of timer blocks or event controllers. So I'm not sure what's next. If someone is using the script and needs something, I'll be happy to look into it.

Example

This is an example that I am using in my current build to control an automated parking arm that grabs my rover when it parks and spins it around so it's ready to leave:

Machine:Parking Option:OutputLCD(Helm Parking, 0) When:Command(Reset) ThenGo:RESET State:UNKNOWN State:RESET When:ConnectorState(Parking Arm Connector, LOCKED) ThenGo:ERROR Step: Action:TriggerTimer(ParkingArmMovingTimerBlock,NOW) # Start the warning lights Action:SetAngle(Parking Arm Advanced Rotor,0,2,ANY) Step: Action:SetPosition(Parking FB Piston,0,1) Action:SetPosition(Parking LR Piston,0,1) Go:STOWED State:STOWED Action:TriggerTimer(ParkingArmStoppedTimerBlock, NOW) When:Command(Park) ThenGo:PARKING State:PARKING Step: Action:TriggerTimer(ParkingArmMovingTimerBlock,NOW) # Action:SetAngle(Parking Arm Advanced Rotor,270,2,NEG) Step: Action:SetPosition(Parking LR Piston,3.5,2) Step: Action:SetPosition(Parking FB Piston,10,0.5) When:ConnectorState(Parking Arm Connector, READY) ThenGo:PARKING.Capture Go:ERROR Step:PARKING.Capture Action:LockConnector(Parking Arm Connector, LOCKED) Step: Action:SetValueFloat(Parking Arm Advanced Rotor,Displacement,-0.11,2) # Lift vehicle using rotor displacement Step: Action:SetAngle(Parking Arm Advanced Rotor,90,2,ANY) Step: Action:SetValueFloat(Parking Arm Advanced Rotor,Displacement,0.11,2) Go:PARKED State:PARKED Action:TriggerTimer(ParkingArmStoppedTimerBlock,NOW) # When:Command(Park) ThenGo:PARKING When:ConnectorState(Parking Arm Connector, UNLOCKED) And:SensorState(Parking Occupied Sensor, NOT_DETECTED) ThenGo:RESET State:ERROR

1 Comments
bosselorentzon 22 Jun @ 9:04am 
lovley done!