Space Engineers

Space Engineers

Renamer
4 条留言
CamariX 2023 年 6 月 17 日 上午 10:03 
[ i ] won't appear on my previous comment. all code without the problem

void Main(string argument)
{
String ShipName = "BASE - ";
String Rename = "LVLX - ";
String BlockName = "";
List<IMyTerminalBlock> Blocks = new List<IMyTerminalBlock>();
GridTerminalSystem.GetBlocks(Blocks);
for (int no = 0; no < Blocks.Count; x++)
{
BlockName = Blocks[no].CustomName;
if (Rename != "")
{
Blocks[no].CustomName = Blocks[no].CustomName.Replace(Rename, ShipName);
}
if (Blocks[no].CustomName.StartsWith(ShipName) == false)
{
Blocks[no].CustomName = ShipName + BlockName;
}
}
}
CamariX 2023 年 5 月 19 日 上午 10:37 
Back. This script has a small problem with renaming.
Just change line by :

if ( Blocks .CustomName.StartsWith(ShipName) == false)

Else the Shipname will be added to the actual name without renaming
CamariX 2023 年 5 月 17 日 下午 2:25 
Works fine ! Use it with programming block
Pote 2022 年 5 月 11 日 上午 7:22 
Works well