Space Engineers

Space Engineers

[Tutorial] Find Blocks By Type
6 kommentarer
XCanG 22. nov. 2015 kl. 8:13 
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 kl. 8:10 
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  [ophavsmand] 2. jan. 2015 kl. 10:52 
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 kl. 9:41 
Hum, how do i see the script?
Jimmacle  [ophavsmand] 1. jan. 2015 kl. 17:07 
Updated, I hope the new comments make sense!
Siegmeyer 1. jan. 2015 kl. 16:29 
Very useful. I was really strugging with that. You might consider adding more in depth comments, especially for the list making and using part.