Space Engineers

Space Engineers

CAT Add Prefix to All Blocks
13 件のコメント
Loues.S.Cat  [作成者] 2016年2月18日 14時18分 
Ohh it is the old old version....
You're better off using the group based renaming one linked in the description.
Loues.S.Cat  [作成者] 2016年2月18日 14時17分 
This script threw an error?
How odd. I was using it myself quite recently. I will have a look.
And to the best of my knowledge you can't grab the name of a ship.
It was made before you could run scripts with arguments, or use Echo but that is a good idea for an upgrade.
SciDerg 2016年2月18日 13時14分 
Grabbing the name of the ship and using that might get clumsy, my ships often have long-ish names ("Large Cargo Freighter"), but I prefix all the blocks with a much shorter version or acronym so I can actually see which block I'm clicking on.
Just getting the ship name in this case would give me a page full of"Large Cargo Freighter ..." entries, and I wouldn't see the full name until I clicked on the block.

I'd say you could just make it use a string from the argument box, and that would work fine.
If you wanted the full ship name, you'd only have to type it in once, and you wouldn't need to open up the script editor, just change the text in the argument box.
SciDerg 2016年2月18日 13時07分 
Script didn't compile for me when I tried it, but a small tweak to the line 9 (inside the "AddPrefixToAll()" function)restored it to working order.
I then made a few more tweaks to generally update and clean up the code, but I didn't touch the core logic of it.

I replaced line 9 with this:
List<IMyTerminalBlock> blocks = new List<IMyTerminalBlock>();
GridTerminalSystem.GetBlocksOfType<IMyTerminalBlock>(blocks);

After that, I changed the list index variable to " i " instead of " j " because " i " for index makes more sense to me.

Finally, I replaced the call to "Print()" with "Echo()", and deleted the code defining "Print()".
The Echo function actually works better here because it prints out text directly to the programmable block's menu, and because it's a default function you don't need to define it, saving program space.

Oh yeah, I also re-whitespaced the whole thing, as I prefer al my curly brakets to be on their own lines.
jarhead 2015年4月5日 4時18分 
me too thats why i asked. lol
Loues.S.Cat  [作成者] 2015年4月5日 4時12分 
If you can tell me how to get the name of the ship, sure. As I am not aware of any means to do so I would love to know how to grab a ships name.
jarhead 2015年4月5日 3時40分 
Could you adjust this script to look for the name of the ship and add that as a prefix to all of the blocks on that ship.
Loues.S.Cat  [作成者] 2015年4月5日 3時36分 
Yes, I rather like prefix filtering.
This script is a bit outdated. I use a group based renaming script now.
By using a group based renaming system you can run the same script on any programable block and set a group to decide what to rename target blocks connected to that grid so no editing of the script is needed.
jarhead 2015年4月5日 3時33分 
This is perfect for use with a gps guided mining ship. Now If only I could get the scripts that are used in them changed so they just look for the ship name and put the in the spot they need to so they can look for that as a prefix for the blocks (I am trying to get it so I can have as many of the same ship as possible docked to the same station at the same time without having the scripts from one messing with the others.
Loues.S.Cat  [作成者] 2015年2月12日 11時44分 
Can you describe the behavior you are after?
Judgernaut 2015年2月12日 11時19分 
That would be sublime, Ive ran into this problem so many times now :)
Loues.S.Cat  [作成者] 2015年2月12日 11時15分 
Hmm... No. I will look into that now.
Judgernaut 2015年2月12日 10時58分 
Does it also give the prefix to group names?