Space Engineers

Space Engineers

Not enough ratings
Renamer
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
414.000 B
14 Sep, 2017 @ 2:44am
14 Sep, 2017 @ 3:01am
3 Change Notes ( view )

Subscribe to download
Renamer

Description
This script used for build prefix at each block name. It is necessary for the distinction of the blocks when connecting different ships. Just replace "ShipName" string from "PL1_" to what ever you want. If you want to rename all block put to "Rename" variable string you want to rename and to "ShipName" new value.
4 Comments
CamariX 17 Jun, 2023 @ 10:03am 
[ 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 19 May, 2023 @ 10:37am 
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 17 May, 2023 @ 2:25pm 
Works fine ! Use it with programming block
Pote 11 May, 2022 @ 7:22am 
Works well