Space Engineers

Space Engineers

47 ratings
Group rename script
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
1.227 KB
Jan 2, 2015 @ 6:32am
Apr 13, 2017 @ 11:33pm
14 Change Notes ( view )

Subscribe to download
Group rename script

Description
This simple utility script renames multiple blocks at once.

How to use:
1. Open Control Panel and select blocks to rename,
2.
  • Create a group named "Rename to <New Name>", where <New Name> is the base name to rename the selected blocks with.
    For example, if you select interior lights in a hangar and put them into "Rename to Hangar Light" group, then these lights will be renamed to "Hangar Light", "Hangar Light 2", "Hangar Light 3", "Hangar Light 4", etc.,
  • Alternatively you can add a prefix or suffix to existing block names by putting selected blocks into "Prefix with <New Prefix>" or "Suffix with <New Suffix>" group.
    For example, if you add "Small Reactor 5" and "Battery 2" to "Prefix with Reserve Power" group, then these blocks will be renamed to "Reserve Power Small Reactor 5" and "Reserve Power Battery 2" respectively,
  • Finally, you can remove part of a name by putting blocks into "Remove <Characters to remove> group.
    For example, if you select Small and Large Cargo Containers and add them ro "Remove Cargo" group, then these containers will be renamed to "Small Container", "Small Container 2", etc., "Large Container", "Large Container 2", etc. Please note that this command, unlike all others, is case-sensitive.
3. Load this script into Programmable Block and execute it to actually rename the blocks,
4. Delete all "Rename to", "Prefix with", "Suffix with" and "Remove" groups.

How to turn off "Rename to" numbering:
1. Load this script into Programmable Block,
2. Change the first line from:
const bool use_numbering = true;

to:
const bool use_numbering = false;

Edit 18 mar 2016: "Rename" and "Prefix" commands can now be changed and numbering can be disabled.
Edit 20 mar 2016: Script now reports the amount of renamed blocks.
Edit 16 apr 2016: Added "Remove" command.
Edit 14 apr 2017: Added "Suffix" command.
9 Comments
Knsgf  [author] Jun 16, 2017 @ 8:36am 
BevansDesign:
It's certainly doable. However this script aims to follow the same numbering convention as vanilla game, plus I'm very reluctant to add extra complexity that is only useful in very specific scenarios.
BevansDesign Jun 16, 2017 @ 7:45am 
Great script. Would it be possible to add a leading 0 to numbers if it's renaming more than 9 items so they're listed in order? For example, I've got a bunch of Thrusters, and I'd like them to be named Thruster 01, Thruster 02, Thruster 24, etc.
Solbero Apr 6, 2015 @ 2:02am 
And if you change the line 13 code "string base_name = group_name.Substring(10);" number on the end, you can have multiple things. just add add number on the string line10, "rename1 to " and also modify the line 13 substring(10) to substring(how many letters and spaces you want on the line10 string to be). Basic number is 10 because "rename to " has 10 letters with spaces counted also. If you want "rename1 to " just modify the number 10 on line 13 to "11" cause then there is that extra number :) Hope this wasnt too complicated to explain for all who are going to use this :)
Solbero Apr 6, 2015 @ 1:56am 
Oh, I see your point there. Its just not what I wanted :) Just tested out, and saw the result, it puts number 1 on end of the name you want to rename it, But in this stargate mod I have two different gates where i can choose where to go by naming the gate same name as the second one on the other end. like astostargate and shipstargate. So if you change to original "rename to " with space to something like "rename1 to" without space in the end, you can have multiple programs without need of deleting those groups :) You can come to check things out also if you'd like :)
Solbero Apr 6, 2015 @ 1:47am 
so the cur block says how many spaces are there on the "rename to" line? Many thanks :)
Knsgf  [author] Apr 6, 2015 @ 1:43am 
Solbero :
All you need to do is to change line 16 from:
blocks_in_group[cur_block].SetCustomName(base_name + ((cur_block == 0) ?
"" : (" " + (cur_block + 1).ToString())));

to:
blocks_in_group[cur_block].SetCustomName(base_name + (cur_block + 1).ToString());
Solbero Apr 5, 2015 @ 1:23pm 
I just made it work with "Rename to " and "Rename1 to" you cant just have space there after "to" in the rename1 command :) I made this very useful in stargate mod, thank you :)
Knsgf  [author] Apr 5, 2015 @ 1:04pm 
Solbero :
Do not use numbers with "Rename".
Solbero Apr 5, 2015 @ 12:56pm 
It keeps adding a space in front of the code if I add rename1 to blablabla