Merlin of Mines - Space Engineers

A set of useful scripts for aspiring Space Engineers!

View on GitHub

Air Vent Handler

This Block Handler handles Air Vents. Pretty Straightforward

Default Primitive Properties:

Default Directional Properties

“Enabled” Property

Enables or Disables the given block

#Enable Block
enable "My Airvent"
set "My Airvent" to enabled
turn on "My Airvent"

#Disable Block
disable "My Airvent"
set "My Airvent" to disabled
turn off "My Airvent"

“Power” Property

Turns on or off power to the block. Effectively the same as the Enabled property.

#Turn on
turn on power to "My Airvent"
power on "My Airvent"

#Turn off
turn off power to "My Airvent"
power off "My Airvent"

“Complete” property

Returns true if the airvent is not actively pressurizing or depressuring, false otherwise. Note the “pressurized” and “depressurized” both return true if the airvent is not in progress. To determine the full state of the air vent, use this property in combination with the “Pressurize” property.

Due to a quark of Space Engineers, sometimes completely depressurized is not registered as “Complete” by Space Engineers. As a work around, this property considers a pressurized ratio < 0.0001 as Complete.

#Pressurize Property to depressurize Air Lock Vent
depressurize the "Air Lock Vent"

#Complete Property to wait until we are finished depresssurizing
until the "Air Lock Vent" is depressurized
  Print "Please wait..."

“Run” property

The opposite of “complete”. Returns true if the airvent is actively pressuring or depressuring, false otherwise.

while the "Air Lock Vent" is running
  Print "Please wait..."

“Pressurize” property

Gets or sets whether the air vent pressurizing mode (pressurizing or de-pressuring). This property does not indicate the actual pressurization state, but rather the mode. To get the pressurization state, use this property in combination with either the “Complete” or “Run” property.

until the "Air Vent" is pressurized
  pressurize the "Air Vent"
depressurize the "Air Vent"
when the "Air Vent" is complete
  open the "External Door"

Examples

Here’s a full example to get all possible Air Vent states. Substitute with your own air vent to test yourself.

set myAirVent to "Airlock Vent"

if $myAirVent is pressurizing and $myAirVent is pressurized
  set my display to myAirVent + " is completely pressurized"
else if $myAirVent is pressurizing and $myAirVent is running
  set my display myAirVent + " is pressurizing"
else if $myAirVent is depressurizing and $myAirVent is depressurized
  set my display myAirVent + " is completely depressurized"
else if $myAirVent is depressurizing and $myAirVent is not complete
  set my display myAirVent + " is depressurizing"

increase my display text by "\nLevel: " + $myAirVent level
replay

“Ratio” property

Returns a value between 0 - 1 representing the pressure ratio (oxygen level) of the Air Vent.

depressurize the "Air Vent"
wait until the "Air Vent" ratio < 0.1
open the "Exterior Doors"

“Level” property

Identical to the “ratio” property

depressurize the "Air Vent"
wait until the "Air Vent" level < 0.1
open the "Exterior Doors"