Mother DocsMother Docs
Buy me a Coffee
Steam Workshop
Discord
  • Cheatsheet
  • Mother OS (Ingame Script)
  • Mother GUI
  • Mother Autopilot System (MAPS)
  • Mother Core (Script Framework)
  • Mother Dev Tools
  • Motherland
  • Powered by Mother
  • Brand Guidelines
Buy me a Coffee
Steam Workshop
Discord
  • Cheatsheet
  • Mother OS (Ingame Script)
  • Mother GUI
  • Mother Autopilot System (MAPS)
  • Mother Core (Script Framework)
  • Mother Dev Tools
  • Motherland
  • Powered by Mother
  • Brand Guidelines
  • Cheatsheet
  • Mother OS (Ingame Script)
    • Getting Started

      • Upgrade Guide
      • Installation
      • Command Line Interface (CLI)
      • Configuration
      • Modules
    • Core Modules

      • Activity Monitor
      • Almanac
      • Block Catalogue
      • Intergrid Message Service
      • Local Storage
      • Merge Block Module
    • Extension Modules

      • Air Vent Module
      • AutoLCD Module
      • Battery Module
      • Terminal Block Module
      • Cockpit Module
      • Connector Module
      • Display Module
      • Door Module
      • Gas Tank Module
      • Hinge Module
      • Landing Gear Module
      • Light Module
      • Piston Module
      • Programmable Block Module
      • Rotor Module
      • Screen Module
      • Sensor Module
      • Sorter Module
      • Sound Block Module
      • Thruster Module
      • Timer Block Module
      • Wheel Module
    • Compatibility
    • Troubleshooting
    • Examples
  • Mother GUI
    • Getting Started

      • Installation
      • Configuration
    • Commands
    • Menus
    • Views
    • Examples
  • Mother Autopilot System (MAPS)
    • Getting Started

      • Upgrade Guide
      • Installation
    • Modules

      • Flight Planning Module
      • Map Module
      • Flight Control Module
      • Attitude Module
      • Docking Module
  • Mother Core (Script Framework)
    • Getting Started

      • Upgrade Guide
      • Installation
      • Architecture Overview
      • Managing Script Size & Complexity
    • Building A Module
    • Mother CLI (Console)
    • Core Modules
      • Activity Monitor
      • Almanac
      • Block Catalogue
      • Clock
      • Command Bus
      • Configuration
      • Event Bus
      • Intergrid Message Service
      • Local Storage
      • Log
      • Terminal
    • Utilities

      • Color Helper
      • Number Helper
      • Security
      • Serializer
    • Testing
    • Tutorials
  • Mother Dev Tools
  • Motherland
  • Powered By Mother
  • Brand Guidelines

Command Bus

  • Registering a Command
  • Registering a Simple Block Command
  • Running a Command or Routine
  • Config Commands
  • Construct-Wide Command Sharing
  • Important Commands and Force-Local Execution
  • Built-in Commands
  • Options With Spaces
  • Helpful Members
  • Emitted Events

CommandBus registers commands from core modules, extension modules, and programmable block Custom Data, then resolves and executes them as local commands, routines, or construct-wide delegated commands.

Registering a Command

Commands are usually registered in a module's Boot() method.

LightModule.cs
public override void Boot()
{
    RegisterCommand(new SetLightColorCommand(this));
}

Registering a Simple Block Command

Many commands do one thing to every block of a type that matches a name, group or tag. Use RegisterBlockCommand<T>() from BaseModule instead of writing a command class for each one. This also keeps your script smaller.

DoorModule.cs
public override void Boot()
{
    RegisterBlockCommand<IMyDoor>("door/open", door => door.OpenDoor(), "Door opened: {0}");
    RegisterBlockCommand<IMyDoor>("door/close", door => door.CloseDoor(), "Door closed: {0}");
}
ParameterDescription
nameThe command name, for example door/open.
actionApplied to each matching block.
messageFormat string for the success response. {0} is the block name.

Use a command class with RegisterCommand() when your command needs several arguments, options or custom validation.

Running a Command or Routine

RunTerminalCommand() accepts the same routine syntax the player uses in the programmable block terminal.

DockingModule.cs
GetModule<CommandBus>().RunTerminalCommand(
    "light/color \"Dock Light\" yellow; wait 2; light/color \"Dock Light\" green"
);

That means you can trigger:

  1. Single commands.
  2. Multi-step routines.
  3. Config commands defined in [commands].
  4. Construct-wide commands exported by other Mother instances.

Config Commands

Programmable block Custom Data commands are loaded by Configuration, then executed by CommandBus.

Programmable Block > Custom Data
[commands]
prepareDock=light/color "Dock Light" yellow; wait 1; connector/lock "Dock Connector"

Programmable Block Terminal
prepareDock

Construct-Wide Command Sharing

Mother Core shares command names with other Mother instances on the same construct. If another script exposes a command and your script does not, CommandBus can delegate to that remote instance automatically.

Programmable Block A > Custom Data
[commands]
greeting=screen/print MainDisplay "Hello, Space Engineer!";

Programmable Block B > Terminal
greeting

Important Commands and Force-Local Execution

Prefix a config command with ! to mark it as construct-priority.

Programmable Block A > Custom Data
[commands]
!alert=light/color "Warning Lights" red; sound/play "Alarm"

If another script needs to bypass the important construct command and run its own local definition, prefix the call with !!.

Programmable Block B > Terminal
!!alert

Built-in Commands

CommandDescription
haltHalts the script by clearing every queued delayed task and active coroutine on the Clock. Pending wait delays and parallel commands that have not run yet are cleared.

Options With Spaces

Options accept double-quoted values, so a value can contain spaces. Read it with GetOption().

Terminal
view/go "Cockpit:1" MainMenu --title="Custom Title"
ViewGoCommand.cs
string title = command.GetOption("title"); // Custom Title

Helpful Members

MemberUse
ModuleCommandsCommands registered on this instance
ConstructCommandsCommand names discovered on other scripts on the same construct
ImportantConstructCommandsImportant command names exported by other scripts
FindInstanceWithCommand(name)Returns the script ID that owns a construct command
GetSelfCommandNames()Returns the local command names exported to peers

Emitted Events

CommandBus does not emit any built-in events.

Last Updated: 10/19/26, 3:04 PM
Contributors: Luke Morrison, lukejamesmorrison, Copilot
Prev
Clock
Next
Configuration