Author Topic: Is there a way to color every brick in a save with the same color to another?  (Read 794 times)

reason I'm asking is because I'm working on making this work with the default colorset and well when you get a build that was made in another colorset and load it with default colors there's those greens that should be grays and such and it's a bit annoying to do manually

tiny bump because I want to get this done as soon as I can

Fillcan??
If not, here's another way:

1. Start a server that you have eval/console access to (ie non dedicated internet server)
2. Load the save as yours.
3. Once it's done loading, find a brick with the color that you wish to replace (I'm going to replace the dark brown)

4. Look at the brick and say /getID
5. Open console (`), and do echo(<ID>.colorID);
6. Get out your spray can and scroll to the new color you want. (I'm going to be using yellow)
7. Open console and do echo(findClientbyName(<yourname>).currentColor);
8. Copy the code at the bottom of this post
9. Open console and do eval(getClipboard());
10. Do swapPaintColor("<colorID>", "<currentColor>", "<yourBLID>");
11. Ta da!

function swapPaintColor(%from, %to, %bg)
{
   if(!strlen(%from) || !strlen(%to) || !strlen(%bg))
      return error("ERROR - swapPaintColor - all three values must be entered (from colorID, to colorID, brickGroup)");
   %count = (%group = "brickGroup_" @ %bg).getCount();
   for(%i = 0; %i < %count; %i++)
   {
      %obj = %group.getObject(%i);
      if(isObject(%obj) && %obj.colorID == %from)
         %obj.setColor(%to);
   }
}


couldn't use fillcan since they were all spread out but the console thing worked thanks

actually is there a way to do it to all of one type of brick as well, I want to get the trees too but they use the same color as some things already

something from ages ago, works similarly to what cruxeis posted

This will only work for the default colorset, and YOUR bricks.

%bg=localClientConnection.brickgroup; for(%x=0;%x<%bg.getCount();%x++){%b=%bg.getObject(%x);if(%b.getColorID() == 2){%b.setColliding(0);%b.setRayCasting(0);}}

All of that on one line.

for a specific brick type, use
%bg=localClientConnection.brickgroup; for(%x=0;%x<%bg.getCount();%x++){%b=%bg.getObject(%x);if(%b.getColorID() == <color> && %b.getDatablock() == <datablock>){%b.setColor(<new color>);}}
replacing <color>, <datablock>, and <new color>

the datablock can be found similar to finding the color, just replace echo(<ID>.colorID); with echo(<ID>.getDatablock());

you could use regex and a capable text editor like sublime with a key macro feature to do this too. you'd be editing the save file directly. if the above methods dont work you can contact me about this