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

Intergrid Message Service

  • Configuring Channels
  • Creating a Request
  • Sending a Unicast Request
  • Sending an Open Broadcast
  • Registering a Route
  • Sharing Views With Other Scripts
    • Declaring an Owned View
    • Finding an Owner and Activating a View
  • Response Codes
  • Emitted Events

IntergridMessageService is Mother Core's commnunication layer. It creates request and response envelopes, registers routes, manages channels, tracks active callbacks, and emits messaging events you can subscribe to.

Configuring Channels

Channels are defined in programmable block Custom Data. A blank value means unencrypted, while any non-empty value becomes the passcode used for Security.Encrypt() and Security.Decrypt().

Programmable Block > Custom Data
[channels]
; public channel
*=

; encrypted channel
MyFaction=Sup3rSecr3tP@ssw0rd

; custom channel (unencrypted)
TradeNet=

Creating a Request

CreateRequest() builds a Request with the standard Mother headers already attached.

DockingModule.cs
Request request = GetModule<IntergridMessageService>().CreateRequest(
    // route
    "docking/request",
    // body
    new Dictionary<string, object>
    {
        { "Connector", "Port A" },
        { "Mass", $"{Mother.GetShipMass()}" }
    },
    // custom headers
    new Dictionary<string, object>
    { 
        //
    }
);

Sending a Unicast Request

SendUnicastRequest() expects the target IGC ID, not a display name. In practice you usually resolve that through Almanac.

DockingModule.cs
public void RequestDocking(string targetName)
{
    AlmanacRecord record = GetModule<Almanac>().GetRecord(targetName);

    if (record == null)
    {
        Mother.Print($"Unknown target: {targetName}");
        return;
    }

    Request request = GetModule<IntergridMessageService>().CreateRequest(
        "docking/request",
        new Dictionary<string, object>
        {
            { "Connector", "Port A" }
        }
    );

    long targetId = record.UnicastId ?? record.GetLongId();

    GetModule<IntergridMessageService>().SendUnicastRequest(
        // target id
        targetId, 
        // request object
        request, 
        // callback action (run upon a response to the request)
        message =>
        {
            if (message is Response)
                Mother.Print("Docking response received.");
        }
    );
}

Sending an Open Broadcast

Use SendOpenBroadcastRequest() when every reachable grid should hear the request.

BeaconModule.cs
Request request = GetModule<IntergridMessageService>().CreateRequest(
    "telemetry/ping",
    new Dictionary<string, object>
    {
        { "Position", $"{Mother.GetPosition()}" }
    }
);

GetModule<IntergridMessageService>().SendOpenBroadcastRequest(request, message =>
{
    if (message is Response)
        Mother.Print("Received telemetry response.");
});

Registering a Route

Modules can expose routes with the AddRoute() helper inherited from BaseModule.

CargoModule.cs
public override void Boot()
{
    AddRoute("cargo/status", HandleCargoStatusRequest);
}

Response HandleCargoStatusRequest(Request request)
{
    int containerCount = GetModule<BlockCatalogue>().GetBlocks<IMyCargoContainer>().Count;

    return GetModule<IntergridMessageService>().CreateResponse(
        request,
        Response.ResponseStatusCodes.OK,
        new Dictionary<string, object>
        {
            { "Containers", $"{containerCount}" }
        }
    );
}

Sharing Views With Other Scripts

Scripts on the same construct share their views the same way they share commands. A script declares a view it draws, and other scripts can find the owner and ask it to show the view on a display. This is how Mother GUI can open the MapView from MAPS with view/go.

Mother Core only stores view names. It does not know how a view is drawn, so the owning script handles everything view-specific.

Declaring an Owned View

Register the view in your module's Boot() method. The callback receives the display name (BlockName:SurfaceIndex) and whether the view is being shown (true) or released (false).

MapModule.cs
public override void Boot()
{
    GetModule<IntergridMessageService>()
        .RegisterView("MapView", OnViewActivation);
}

void OnViewActivation(string displayName, bool show)
{
    // take the surface when show is true, stop drawing when it is false
}

Owned view names are included in the construct sync alongside command names, so other scripts learn about them automatically. After another script boots it can take up to 5 seconds for its views to be discovered.

Finding an Owner and Activating a View

ViewModule.cs
IntergridMessageService ims = GetModule<IntergridMessageService>();

long ownerId = ims.FindInstanceWithView("MapView");

if (ownerId != 0)
{
    // show the view on a display
    ims.SendViewActivation(ownerId, "MapView", "Cockpit:0", true);

    // later, release the display
    ims.SendViewActivation(ownerId, "MapView", "Cockpit:0", false);
}
MemberUse
RegisterView(viewName, onActivate)Declares a view owned by this script.
ConstructViewsView names discovered on other scripts, keyed by script ID.
FindInstanceWithView(viewName)Returns the script ID that owns a view, or 0 if no script does.
SendViewActivation(ownerId, viewName, displayName, active)Asks the owner to show (true) or release (false) a view on a display.

Info

SendViewActivation() does not wait for a reply. If the owner does not have the display, it does nothing and no error is returned.

Response Codes

You will reach for these status codes most often:

CodeNameMeaning
200OKGeneral success
201COMMAND_EXECUTEDA remote command ran successfully
401UNAUTHORIZEDThe request was rejected
404NOT_FOUNDNo matching route or target
500ERRORGeneric failure

Emitted Events

EventWhen it fireseventData
RequestReceivedEventAn incoming request is deserialized and routednull
RequestSentEventA unicast or broadcast request is sent successfullynull
RequestFailedEventA unicast request cannot be sent on any available channelnull
Last Updated: 10/19/26, 3:04 PM
Contributors: Luke Morrison, lukejamesmorrison, Copilot
Prev
Event Bus
Next
Local Storage