Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Whip's Simple Renamer v1 - 12/8/15
- //You can change these
- string searchFor = "1";
- string replaceWith = "2";
- //Dont touch below this
- int renameCount = 0;
- void Main()
- {
- int renameCount = 0;
- var blocks = new List<IMyTerminalBlock>();
- GridTerminalSystem.GetBlocksOfType<IMyTerminalBlock>(blocks);
- for (int i = 0; i < blocks.Count ; i++)
- {
- var thisBlock = blocks[i] as IMyTerminalBlock;
- if(thisBlock.CustomName.Contains(searchFor))
- {
- renameCount++;
- string currentName = thisBlock.CustomName;
- string newName = currentName.Replace(searchFor, replaceWith);
- thisBlock.SetCustomName(newName);
- }
- }
- Echo(renameCount.ToString() + " blocks renamed");
- }
Advertisement
Add Comment
Please, Sign In to add comment