Event Controller

From Space Engineers Wiki
Jump to navigation Jump to search
Event Controller
Icon Block Event Controller.png

Category: Functional
Function: implements if-then-else behaviour

Fits small grid
Mass: 38.4 kg
Power: 0.0005 MW
PCU: 10
Size: 1x1x1
Time to Build: 5 sec

Fits large grid
Mass: 304.0 kg
Power: 0.0005 MW
PCU: 10
Size: 1x1x1
Time to Build: 12 sec

Data Controls: [edit] [purge] (?)

The Event Controller is a functional automation block in Space Engineers that gives your grids "senses" for its own blocks.

Usage

The Event Controller monitors the grid's block states for you, and when values change, it reacts by triggering your chosen toolbar actions[1]. Use this automation block in conjunction with other Artificial Intelligence blocks to create logic systems.

Event-controller.png

Picture "events" as a way to give drones commands in an if-this-then-that format. For example in case of a mining drone, “If your cargo is full, then return to base”. Or in case of base automation, "If the piston elevator reaches the middle floor, stop and open the doors", and many more.

Examples

  • When someone passes through the airlock, automatically open the doors and preserve oxygen.
  • If essential blocks are destroyed, switch on self-projectors and welders for repairs.
  • If a fighter drone is out of ammo or has lost its weapons, retreat to connector in hangar.
  • If hydrogen runs low, then produce more and switch a tank to “stockpile”.
  • If intruders are detected, then switch on a labelled beacon to call faction mates for defence.
  • If the base is low on gas/fuel/power/ammo, then switch on a coloured warning light to warn faction members.
  • During ascent from planet at max speed, decrease thrust override to not waste hydrogen, and below min speed increase thrust override, and switch off the override when natural gravity is zero.

And more ...!

Tip: Use an Emotion Controller LCD panel (DLC only) to display simple status changes along with these actions.


What are the EC's advantages and differences?

The Event Controller exposes a lot of functionality to the vanilla game that was formerly accessible only through scripting and modding. Even players on consoles that disallow scripts, and any players who cannot write scripts, can use an Event Controller to do basic "programming".

How is the EC different?

  • Automatons, weapon AI and CTC AI detect other grids up to 2-2.5km away -- while the Event Controller monitors only its own grid.
  • Automatons, Sensors, weapon AI and CTC AI react to grids, meteorites, or players -- while the Event Controller watches only blocks.
  • The Event Controller can monitor a wider variety of state changes on its grid than a Sensor or an Air Vent can.
  • In contrast to scripts and script mods, the Event Controller also works on consoles.

Which Events Can Be Detected?

The EC monitors only blocks on the same grid, or on a connected or merged) grid!

What can the Event Controller detect?
Event Condition Values Examples Blocks
Altitude is equal or greater/less than 1-50000 metres Keeping hovercraft or shuttles above the ground (thrusters in six directions) N/A
Angle Changed is equal or greater/less than -360 to +360 degrees Detect that Hinge/Rotor has reached a specific orientation Hinge, Rotor
Block Added/Removed N/A N/A Detect boarders, detect damage to own grid Any blocks.
Block Integrity Percentage is equal or greater/less than 0-100% detect damage on same grid, detect 3D Printer completion A set of functional blocks of your choice, excluding armor blocks
Block On/Off Switched is (Select from the grid's blocks) If H2 Generators are on, then also switch certain tanks to stockpile A set of functional blocks of your choice, excluding armour blocks
Cargo Filled Percentage is equal or greater/less than 0-100% make miner return to base if 80% full, produce ammo if running low, warn if running out of ice or uranium, ... Any Inventory: Cargo Containers, Block Weapons (ammo), Reactor (Uranium), Block Tools, Assembler, Refinery, Collector, Connector, Cockpits, Survival Kit, Cryo Chamber, bottles in Tanks, ice or bottles in O2/H2 Generator, parachutes in hatch, chips in Safe Zone, Store, Target Dummy, ...
Cockpit Occupied is Yes/No If player seated then toggle batteries, open hangar doors, etc. Cockpit, Industrial Cockpit, Fighter Cockpit, any passenger Seats, Bathroom, Toilet Seat, (Corner) Couch, Cryo Chamber, Helm, ...
Connector Connected is Yes/No if docked ship detected then extend walkway, load ammo, offload cargo ... Connectors
Connector Ready to Lock is Yes/No if close then lock Connectors
Distance to Locked target is equal or greater/less than 1 - 2500 metres Ignite warheads; drop tactical decoys; launch PBWs Cockpits and Control Seats that have target locking active
Door Opened is Yes/No Switch on/off lights, (de)pressurise the room or airlock, start 2 sec Timer that closes all doors Door, Offset Door, Sliding Door, Airtight Hangar Door, ...
Gas Tank Filled Percentage is equal or greater/less than 0-100% Switch O2/H2 Generator on/off, switch Tank Stockpile on/off Oxygen Tanks, Hydrogen Tanks
Grid Speed Changed is equal or greater/less than 0 - 100 m/s React to own Inertial Dampers, save fuel by decreasing thrust override, prevent falling in Gravity None
Landing Gear Locked is Yes/No rotate crane after it has picked up a block Landing Gear, Magnetic Plate
Magnetic Gear Ready is Yes/No Lock Landing Gear when close enough Landing Gear, Magnetic Plate
Merge Block merged is Yes/No 3D Printer automation Merge blocks
Natural Gravity Changed is equal or greater/less than 0 - 10 g Adjust speed or switch thrusters when leaving or reaching a planet None
Piston Position Percentage is equal or greater/less than 0-100% stop the elevator at a floor Piston
Power Output Percentage is equal or greater/less than 0-100% Switch off H2 engine while wind/solar is producing Battery, Reactor, Solar Panel, Hydrogen Engine, Wind Turbine
Rotor/Hinge attached/detached is Yes/No 3D Printer automation, truck hitches Rotors, Hinges
Stored Power Percentage is equal or greater/less than 0-100% toggle battery discharge/recharge/hydrogen engines Batteries
Thrust Percentage is equal or greater/less than 0-100% Keep speed at a certain level Thrusters

For comparison:

What can other blocks detect and at which range?
Event Condition Values Examples Detector Blocks
Adjacent room pressurised is yes/no Air Lock cycle See Air Vent
Subgrid proximity is equal or greater/less than 0.1 to 50m 3D Printer See Sensor
Players on foot is equal or greater/less than 0.1 to 50m Airlocks, traps See Sensor
Floating items is equal or greater/less than 0.1 to 50m ore collectors, grid damage/debris detection See Sensor
Asteroid proximity is equal or greater/less than 0.1 to 50m Automatic asteroid miner See Sensor! (For automatic collision avoidance, see AI Flight)

Which Reactions can be triggered?

Similar to Timer Blocks and Sensors, any action that is available on the Tool Bar for blocks on the same or a connected[2] grid can be triggered.

Click Select Actions to define two actions that are triggered when the condition is (or is not) met.

  • Use the first action slot to react to the event.
  • Use the second action slot to "reset" to the normal state.
  • Press ctrl 1-9 to get nine first and second toolbar slots.

Tip: You want to trigger more than one action? Put all actions into a Timer Block, and set the the Event Controller actions to Timer Block Start/Stop.

Some actions set a value (e.g. "unlock") while others toggle (invert) the current state (e.g. "switch lock"). The game sometimes runs triggers twice which can throw off your system if you use the EC to invert settings instead of setting a value. One workaround is to use the first EC to watch an event and then switch a light on or off, and then use a second EC to watch the light.


How to React to Events

  1. Build an Event Controller and open its Control Panel Screen.
  2. Choose from the Event list which event you want to monitor.
  3. (If applicable) Select your Condition for the event.
    Example: "value is equal or greater than the threshold value".
  4. (If applicable) Enter the Threshold value of your condition.
    Example: 0-100% for percentages, -360 to 360 for rotation, and so on.
  5. (For Block Events only) Choose blocks:
    1. Search the list of applicable blocks on the grid.
    2. Select blocks to monitor under Available Blocks and click Add Blocks.
    3. To remove a block from monitoring, select it under Selected Blocks and click Remove Blocks.
  6. Click Select Actions.
    • Assign to the first slot the action how to react to the event.
    • Assign to the second slot the action how to reset after the event is over.
  7. (For Block Events only) Choose how many of your selected blocks must fulfil the condition:
    • If all blocks must fulfil the condition, enable AND Gate.
    • If at least one block must fulfil the condition, disable AND Gate.

How many ECs will I need?

Be prepared to need one or two ECs for basic automation, and more for more complex chains of actions. Each "If value higher than this then do this, else do that" statement corresponds to one EC block and one or two Timers. Give them descriptive names so you can distinguish them.

You will typically accompany the ECs with several Timer blocks to group triggered actions that should happen together. In the end, your bridge will look like a mainframe server room and your drone will have a big brain in its skull.

On large grid, you can save space and components by building a cluster of only small-grid ECs and Timers, and attaching them to the large grid through a locked rotor, similar to how to build warning lights.


What's the status?

The EC block shows its status by changing the color of the lights on its front panel, similar to Timers.

  • Red means it's switched off or has no power
  • Green means it is ready and has power but no event condition has been set up
  • Blue means it's monitoring a configured event but the condition was not yet met
  • Cyan means an event has triggered an action

Should I watch ALL blocks or ANY blocks?

For many events, you can monitor several blocks. In this case you need to tell the EC what exactly you mean:

  • Switch on reactors when any one tank/battery is empty, or only when all of them are empty?
  • Sound an alarm when any weapon block is damaged, or only when all of them are danaged?
  • Repressurise the room when any of its doors get closed or when all its doors have been closed?

And similar. You see the difference in meaning!

How to choose:

  • If any chosen block meets the condition, I want the first action.
    If no chosen block meets the condition, I want the second action.
    <= You should disable AND Gate
  • If all chosen blocks meet the condition, then I want the first action.
    If some or no chosen blocks meet the condition, I want the second action.
    <= You should enable AND Gate.

History

Before Update 1.203, there used to be unexpected AND Gate behaviour so you may need to adjust some older block set-ups.

With AND Gate disabled, the EC originally did not monitor "the state" of these blocks like a logical formula. It just reacted to events in the moment they happen [3].

Example: You had been monitoring if any of two doors are being opened:

  1. both A and B closed -> EC slot 2 triggers
  2. door A is opened -> EC slot 1 triggers
  3. door B is opened -> EC slot 1 triggers
  4. door A is closed -> EC slot 2 triggers?!

In both situation 2 and 4, one door was open and one was closed, but the EC reacted differently. It did not react to the state that they were in (how many are open/closed), it reacted to the event (one is opening or closing).

In-depth Tutorials

Vanilla logic gate tutorial by Wolak uses no scripts and is well suited for people who like Minecraft Redstone.

Construction

If Progression is on, build a basic Assembler and some lighting block first to unlock this block. The Event Controller is 1x1x1 blocks large and exists for small and large grid. It uses 500W power.

The Event Controller block is quite cheap to build and can be used in early game, but it's also very fragile and breaks easily when exposed in battle. The large grid version has a built-in Control Panel. To access the small grid variant, you need to add a Control Panel or use a cockpit or any other block with terminal access.

Neither block variant has any configurable LCDs, but both have a very techy looking front panel that can also be used for decoration.

Recipe

Icon Block Event Controller.png Event Controller
ComponentLarge Ship/Station
Required
Large Ship/Station
Optional
Small Ship
Required
Small Ship
Optional
Icon Item Interior Plate.png Interior Plate102
Icon Item Display.png Display41
Icon Item Computer.png Computer102
Icon Item Construction Comp..png Construction Comp.201021



Functional Blocks

References

  1. https://twitter.com/SpaceEngineersG/status/1587483354391228416
  2. Through a Connector, you can even remotely trigger an Event Controller. The trigger event can be as simple as toggling a light on. The trick is to have the event controller on the drone start watching a block (e.g. a light) on the carrier's grid when the drone is docked. Once undocked, the event controller still watches the block even though the grids are separate. Keen may change this though as it could be considered a bug. 🙂
  3. https://support.keenswh.com/spaceengineers/pc/topic/28005-event-controller-does-not-properly-track-block-states-in-normal-or-mode