The Running Programmable Block

From Space Engineers Wiki
Jump to navigation Jump to search

One of the more frequently asked questions for beginners, is how to get a hold of the programmable block or the grid containing the programmable block that is running the current scripts. This is quite simple. The base class of the scripts, MyGridProgram, has a special property for this called Me.

public void Main() {
    // Write the name of the running programmable block into its detail area
    Echo(Me.CustomName);

    // Write the name of the grid containing the programmable block into its detail area
    Echo(Me.CubeGrid.CustomName);
}



This tutorial was adapted from the original on Malware's MDK wiki, by the author.