Space Engineers

Space Engineers

Not enough ratings
CAT Group Based Renaming
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
2.272 KB
12 Feb, 2015 @ 2:22pm
23 Oct, 2017 @ 3:24am
6 Change Notes ( view )

Subscribe to download
CAT Group Based Renaming

In 1 collection by Loues.S.Cat
CAT Scripts
12 items
Description
/*
* Perform some changes to groups of blocks custom name based on the group name

* $RENAME <newName> changes each blocks name to match newName
* $RENAME# <newName> As Above but numbered sequentially in ascending order

* $ADDTAG <tag> Adds <tag> to the end of each blocks name (if it isn't already in the name. this may cause problems if you want to add 'Bat' to an item with the name Battery)
* No numerical tagging feature for this one. Sorry.

* $ADDPREFIX <tag> Adds <tag> to the start of each block name (if it doesn't already)
* $ADDPREFIX# <tag> As Above but numbered sequentially in ascending order

* $CLEAR Reset to default name (un-Numbered)
* $CLEAR# Reset to default name (Numbered in ascending order)
*/

There is now a global variable called "GI_LoN". Setting this to a value greater than 0 will set the default minimum length for numbers in a sequencial numbering case.
Numbers less than the required length will be padded with '0' so that if GI_LoN==3 then 1 becomes 001 and 10 becomes 010, but anything beyond this length such as 100 or greater remains unchanged.
Leaving GI_LoN at 0 will cause the script to find the minimum length on it's own, so lon becomes 2 if 99 or fewer blocks are in the target group, 3 if 999 or less, 4 if 9999 or less, ect.
lon minimum value remains 2.
41 Comments
Flatfoot 16 May, 2020 @ 1:52pm 
For some reason, whenever I use adaptive LoN (Gl_LoN=0), the script likes to add way to many zeros for numbers past 20. (Gives 3+ for 30).

I tweaked a fix by the following code.
[code]
public int getLoN( int cnt ) {
int lon = 0;
if( GI_LoN <= 0 ) { lon = cnt.ToString().Length;
//lon = 2;
//while( cnt / (1f+(10f*lon)) >= 1 ) {
// lon++;
//}
} else {
lon = GI_LoN;
}
return lon;
} [/code]
Thundagar 26 Oct, 2019 @ 6:08pm 
Thank you verry much :)
Dragon18Actual 19 Oct, 2019 @ 4:37pm 
Once you get the script set up in a programable block, create a group from the control panel of all the things you want the name modifed. So for example, if you got 100 O2 generators, and want to rename them and number them, you'd select them all, then name the group "$RENAME# My Oxygen Generators (Or what ever you want them to be called)" then save the group, then go to the programable block and hit "Run"

Should be close to that anyway, it's been awhile since I've played, but in short, it's all in how you name the group.
Thundagar 19 Oct, 2019 @ 2:36pm 
I'm a noob to these scripts and how to use them fully, i do know you add them to programable blocks and how to load them. have gotten a couple scripts running fine but how do you use this script. do you add the $ADDPREFIX <ShipName> to the argument line and then click run or is there another way your supossed to do this? thanks for any help :)
Dragon18Actual 28 Apr, 2019 @ 7:43pm 
Sorry to double post. Just thought I'd let everyone know. I've been playing this again a bit today and this still works.
Dragon18Actual 13 Jan, 2019 @ 7:43am 
I haven't played in a couple of months, but the last time I played, it still worked fine.
DarthNovii 12 Jan, 2019 @ 8:29pm 
Is this still working?
Nixx 10 Nov, 2017 @ 8:50am 
int issue on line 22
Loues.S.Cat  [author] 23 Oct, 2017 @ 7:21pm 
I could do. Though right now it is 3am so... later... because it can't get too much earlier than 3am X.x
Flatfoot 23 Oct, 2017 @ 6:46pm 
Loues, did you integrate the REMOVETAG and REPLACETAG functions into your script?