Space Engineers

Space Engineers

Ei tarpeeksi arvosteluja
[Tutorial] Find Blocks By Type
   
Palkinto
Lisää suosikkeihin
Lisätty suosikkeihin
Poista suosikeista
Tiedostokoko
Julkaistu
Päivitetty
359.510 KB
1.1.2015 klo 12.28
1.1.2015 klo 17.06
3 muutosilmoitusta ( näytä )

Tilaa ladataksesi
[Tutorial] Find Blocks By Type

Kuvaus
A quick script I wrote to help teach others how to find and manipulate blocks of a certain type on a grid.
6 kommenttia
XCanG 22.11.2015 klo 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.11.2015 klo 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  [tekijä] 2.1.2015 klo 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.1.2015 klo 9.41 
Hum, how do i see the script?
Jimmacle  [tekijä] 1.1.2015 klo 17.07 
Updated, I hope the new comments make sense!
Siegmeyer 1.1.2015 klo 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.