Space Engineers

Space Engineers

Block Naming Made Easy
36 Comments
Syhkane 4 Nov, 2021 @ 10:04pm 
OK not sure why this works at all, i literally spent 45 minutes just typing " 01" in places
but the bottom line (again i dont know what any of this means or does) i added + " 01" in that last bit and it renames all my blocks without numbers the way i wanted it to.

if (numberBlocks) {shipDictionary.Add(nameToWrite, 1);}
shipList .CustomName = nameToWrite + " 01";
Syhkane 4 Nov, 2021 @ 9:14pm 
what line is the exception I have to remove to rename the first item in a series 01? I dont know programing so I dont know how to identify it myself to remove it.
Atl3m 3 Feb, 2021 @ 6:24am 
is there a script naming a block using timer or button. like isys auto sorter you have the option to have locked in the connectors/container/blocks name to lock it from the script. i need a script that can toggle this name from connector to connector locked using timer/button/programblock
MrStump  [author] 16 Apr, 2020 @ 4:08am 
May be. Its very old and I haven't played Space Engineers since 1.0
troubled_offspring 15 Apr, 2020 @ 7:08pm 
is this broken? it does not appear to load into program blocks for me it always comes up blank
PyreStarite 27 Dec, 2018 @ 11:10pm 
Is it possible to implement custom names? Eg. Corner Light - Double to Double Corner Light or Hydrogen Thruster to Hydro Thruster or H Thruster.
MrStump  [author] 16 Dec, 2018 @ 6:44am 
Sorry, this is an old script and I haven't played in a while (waiting for survival rebalance). I used the old naming scheme from the game, which I think they updated. It is totally possible to call it Light 01, but I don't have the game installed to modify the code. If you poke around in it, you should see an exception I put in to AVOID numbering the first entry. Good luck
Dakroth 15 Dec, 2018 @ 2:49pm 
I was foing to ask the same thing as Extevious-V. Is that something that can be done, or are you only able to modify the numbering scheme for blocks that get numbered by default?
Extevious 10 Sep, 2018 @ 12:23am 
It should be renamed like this: Light 01, Light 02, Light 03, Light 04, etc.
Extevious 10 Sep, 2018 @ 12:22am 
Is it possible you could update this script to include numbering the first block?

For example: Light 12, Light 6, Light 16, Light 35, etc would be renamed to: Light, Light 02, Light 03, Light 04, etc. This would save me a few seconds of renaming the first block for each block type.

Thanks!
MrStump  [author] 1 Jun, 2018 @ 3:58pm 
Didn't used to, no. You just click the run button and it does it as a 1-time job.
Kirckhoff 30 May, 2018 @ 11:10pm 
Do I need a timer block for this to work?
WaviestBow6 11 Jan, 2018 @ 10:32pm 
Hooray! Thank you for this mod! I was always so obssesed with having everything perfectly numbered!:steamhappy:
Snøfler 6 Feb, 2017 @ 9:49am 
That was fast, thanks :steamhappy:
MrStump  [author] 6 Feb, 2017 @ 9:24am 
HOORAY! I was able to update it to take advantage of the new alphabetical system. I also updated away from the old way of setting custom name, which gets rid of the "check code" errors entirely.
MrStump  [author] 6 Feb, 2017 @ 8:55am 
Ah, I hadn't seen this change. I will look into it, although I'm very out of practice in C#, so no promises =/
Snøfler 6 Feb, 2017 @ 8:14am 
Any chance for this to be updated so that it uses the same numbering as the newer versions of the game?

New way:
01 02 03 04 05 06 07 08 09 10 11 12
Old (current) way:
1 10 11 12 2 3 4 5 6 7 8 9
MrStump  [author] 30 Jan, 2017 @ 1:24pm 
I had forgotten about this when I took a break from SE. I came back a few weeks ago and saw it still worked just how I wanted it to. Glorious! haha

I have since forgotten everything I learend about C#. I am glad I wrote that code snippet now because I wouldn't be able to compose it now!
Tor 30 Jan, 2017 @ 9:34am 
thanks for that comment stump, makes it easy to set up even if it isnt in native functionality.

still works well btw.
MrStump  [author] 19 Apr, 2016 @ 6:30pm 
Yes Rogue, and here is how it is done. Delete line 67. It currently says:
if (restrictedGrid != shipList[i].CubeGrid & restrictToGrid ) {continue;}

Now replace it with the following 2 lines:
string currentShipName = shipList[i].CustomName;
if (restrictedGrid != shipList[i].CubeGrid & restrictToGrid | currentShipName.Contains("!")) {continue;}


There you go, now it will ignore any ship part which has a ! in its name. if you like, you can change what is inside of the quotes to any string. (examples: "[Ignore This]" or "$$$")

This is an intelligent feature I should impliment perminantly into the code. I may do it later, but I can't just this moment. Until then, I hope this helps! I tested it and it worked for me, but let me know if it causes and problems!
RogueDelta 19 Apr, 2016 @ 12:20pm 
Is there a way to add a block name or descriptor that wouldn't be changed or replaced by this scrypt when run, such as putting the block info/descriptor into brackets [] or ( ) or " "? That way the script would ignore anything within the defined exclude notation/symbols.

I tend to name the blocks as I place them, it would be nice not to have to try and ID and rename blocks again later, I really just want to quickly add/change the Ship Name/ID and sequential number of the component, especially when copy/paste several identical ships.
Chuck 25 Mar, 2016 @ 9:19pm 
Yeah that's fair enough, thanks for posting your script, I am 100% positive I will find uses for it. My comment was not intended as a critique, but more of a warning to those who (also) don't understand what the script does. Its entirely possible I'm the only one that stupid. :steamhappy:
MrStump  [author] 22 Mar, 2016 @ 7:34am 
I worked through several ways to approach this code, Chuck. The one you raise was considered, but what if you name a ship and want to later change the name? Or what if you rename some items entirely, does the numbering start over?

I tend to only do a mass-renaming once, when I first create a station/ship. Then I go in an edit names (what connector goes to what, etc). It is an imperfect solution, I agree. A placeholder for what I hope will be a proper fix in the future. Like using the Ship Name automatically when you view control panel elements from another grid as part of the game.

The kind of script you are talking about is possible, but situational. You may be able to edit this code (or someone else might) to make it happen, but I am afraid I'm not up for the task.
Chuck 22 Mar, 2016 @ 12:36am 
My advice is to save first as a different named game. This script will name custom names to near-default. So all of those "Solar 5 Bottom rotor inverted" or 'Atrium Upper Middle panel" type names will now simply be "ShipName - Rotor 4" and "ShipName TextPanel 3".

Welcome to long hours of grinding, renaming and re-welding, and accessing a terminal a few thousand times. :steamsad:

I wonder if it's possible to simply add the ship suffix and a number on the end, without touching the contents of the existing names? Or maybe just changing the numbers on the end if there is already a number. Seems like that sort of logic should be possible. At worst case, a config option to only attach ship names, or only append numbers would be amazing.
Dakroth 20 Mar, 2016 @ 11:06am 
Yeah, I realized the problem was with the grid restriction feature, so I just removed all references to that. Glad that it's complete though!
MrStump  [author] 19 Mar, 2016 @ 7:45pm 
Thank you plaYer2k. I have added your correction to the code and published, it should work fine for everyone now. I didn't know about the change, you saved me some trouble trying to figure it out. Appreciate it!
Engi 19 Mar, 2016 @ 4:36pm 
plaYer2K: I just cut your what ever that was vrage... and pasted it in place of the sandbox... on line 45 and it worked like a charm. Thanks.
Dakroth 18 Mar, 2016 @ 7:49pm 
I think I understood that, so I'll give it a shot. Thanks!
plaYer2k 18 Mar, 2016 @ 2:16am 
I dont use this script so i dont know the exact code but the error: "Line 45: Type or namespace 'IMyCubeGrid' does not exist in the namespace 'Sandbox.ModAPI.Ingame" indicates that at line 45 the type is given explicite with full namespace and that has changed lately.
So one way to fix it should just be to remove any Namespaces in front of the IMyCubeGrid which probably looks like Sandbox.ModAPI.Ingame.IMyCubeGrid or you change it explicitely to VRage.Game.ModAPI.Ingame.IMyCubeGrid and it should work again unless there are more errors.
Dakroth 17 Mar, 2016 @ 7:45pm 
Hey, your script has been disabled. Error states "Line 45: Type or namespace 'IMyCubeGrid' does not exist in the namespace 'Sandbox.ModAPI.Ingame'

I depend in this mod to save me from hours of mindless renaming of all the blocks in my ships to satisfy my irrational need for complete uniformity!!! Must work wuickly! :P
Sutima 5 Feb, 2016 @ 6:25pm 
Can't upvote enough... How can i upvote more ?
WOOOW i love this
Kephyr DeBlini 4 Feb, 2016 @ 1:28pm 
you are a saint.
DeAnti 4 Feb, 2016 @ 9:38am 
favorite
Rhone's Corner 3 Feb, 2016 @ 6:51pm 
This is a VERY helpful script!!! After playing for a while and neglecting to rename, things get... messy. especially when docking multiple ships to one station and trying to figure out where the hell you put that new timer block, etc!
Dakorok 3 Feb, 2016 @ 4:39pm 
5/5 bretty gud