Difference between revisions of "Template:APIStub"

From Space Engineers Wiki
Jump to: navigation, search
(Examples: Added examples for how to use GridTerminalSystem)
(Undo revision 11745 by Textor (talk) Didn't realize this was editing the template.)
 
Line 5: Line 5:
  
 
== Examples ==
 
== Examples ==
===Search For Single Block With Name===
 
 
<syntaxhighlight lang="csharp">
 
<syntaxhighlight lang="csharp">
void Main()
+
//Examples here
{
 
    IMyBeacon beacon = GridTerminalSystem.GetBlockWithName("Beacon"); //beacon is initialized to the first block that is named "Beacon"
 
}
 
</syntaxhighlight>
 
===Search For All Blocks Of Type===
 
<syntaxhighlight lang="csharp">
 
void Main()
 
{
 
    List<IMyTerminalBlock> blocks = new List<IMyTerminalBlock>();
 
    GridTerminalSystem.GetBlocksOfType<IMyBeacon>(blocks); //search for all blocks of type "beacon" and put them into the "blocks" list.
 
}
 
</syntaxhighlight>
 
===Search For All Blocks With Part of a Name===
 
<syntaxhighlight lang="csharp">
 
void Main()
 
{
 
    List<IMyTerminalBlock> blocks = new List<IMyTerminalBlock>();
 
    GridTerminalSystem.GetBlocksOfName("[Docking]", blocks); //retrieves all blocks with the string [Docking] in the name and puts them into the blocks list.
 
}
 
 
</syntaxhighlight>
 
</syntaxhighlight>
  

Latest revision as of 08:32, 10 January 2015

Template:API

Usage

Examples

//Examples here

Notes