Space Engineers

Space Engineers

Not enough ratings
[Tutorial] Find Blocks By Type
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
359.510 KB
1 Jan, 2015 @ 12:28pm
1 Jan, 2015 @ 5:06pm
3 Change Notes ( view )

Subscribe to download
[Tutorial] Find Blocks By Type

Description
A quick script I wrote to help teach others how to find and manipulate blocks of a certain type on a grid.
6 Comments
XCanG 22 Nov, 2015 @ 8:13am 
My example, that didn't work:
public void Main()
{
string timerName = "Timer Block";
IMyTimerBlock TimerBlock;
List<IMyTimerBlock> TimerBlocks;
TimerBlock = GridTerminalSystem.GetBlockWithName(timerName) as IMyTimerBlock;
TimerBlock.GetActionWithName("Start").Apply(TimerBlock);

// var timerBlocks = new List<IMyTerminalBlock>();
// GridTerminalSystem.SearchBlocksOfName(timerName, timerBlocks);
// for (int i = 0; i < timerBlocks.Count; i++) {
// timerBlocks[i].GetActionWithName("Start").Apply(timerBlocks[i]);
// } }
XCanG 22 Nov, 2015 @ 8:10am 
Hi! How to find block by name? I have Projector blueprint, this blueprint have timer block, I need to start this timer when I run script. Probably is: on my ship I have another timers and timer, that spawn every new spawn add number (e.x. Timer Block 23, Timer Block 24 ...). Can you help me to find this timer with script?
Jimmacle  [author] 2 Jan, 2015 @ 10:52am 
The second screenshot shows the script, however I have updated the comments since I took that screenshot to be more noob-friendly.
Dant 2 Jan, 2015 @ 9:41am 
Hum, how do i see the script?
Jimmacle  [author] 1 Jan, 2015 @ 5:07pm 
Updated, I hope the new comments make sense!
Siegmeyer 1 Jan, 2015 @ 4:29pm 
Very useful. I was really strugging with that. You might consider adding more in depth comments, especially for the list making and using part.