Author Topic: Change all bricks with certain paint color to another color  (Read 2031 times)

Spread out all around my server are thousands of blue bricks. I want to make them green. Can I do this with eval?

I don't know the exact color codes so I need a way to find that too.


Code: [Select]
for(%m = 0; %m < MainBrickGroup.getCount(); %m++)
{
%brickGroup = MainBrickGroup.getObject(%m);

for(%b = 0; %b < %brickGroup.getCount(); %b++)
{
%brick = %brickGroup.getObject(%b);

if(%brick.getColorID() == BLUE)
{
%brick.setColor(GREEN);
}
}
}

Replace BLUE with the ID of the blue color.
Replace GREEN with the ID of the green color.

Highlight the above code, copy all of it (with the necessary changes), type
Code: [Select]
eval(getClipboard());
into the console.

Note that color IDs start at 0; you can count the colors in your spraycan HUD to get the color ID yourself. This will paint all bricks loaded on the server.

Highlight the above code, copy all of it (with the necessary changes), type
Code: [Select]
eval(getClipboard());
into the console.

I believe he's using a dedicated server without access to the console, but using the eval add-on. That's what he meant in his last topic.

I don't think you could iterate through each brickgroup within the chat limit. You could use commandToServer('eval', "code();");, i think thatll let you get more characters in, but I still think its not enough. You could try doing a container search with a huge radius to find all the bricks, which only takes a few lines.

Wasn't there that eval mod with /startbuildermode, which would allow you to insert entire separate lines and execute them like you would a .cs file?

Why not eval the code into a .cs in the config then execute the code? Or just FTP the code to the server then execute?

Or just FTP the code to the server then execute?

This is probably the best option for a dedicated server.

commandToServer('messageSent', $EvalKey @ getClipboard());

Commands to the server don't have a maximum argument length, AFAIK.

commandToServer('messageSent', $EvalKey @ getClipboard());

Commands to the server don't have a maximum argument length, AFAIK.

Well, you learn something new every day.

commandToServer('messageSent', $EvalKey @ getClipboard());

Commands to the server don't have a maximum argument length, AFAIK.
But it will also be limited by the max message length?

Nah, that limit is imposed by serverCmdMessageSent after the message is transmitted. Since Eval scripts intercept the message before it gets parsed through the parent code for serverCmdMessageSent, you get the full, unrestricted message.