I think this should work:
https://drive.google.com/file/d/0B0FSY34ysJEXN2lqZlNEYzZtaDA/view?usp=sharing/clearbricktype - clears your own bricks that match the datablock of your ghost brick
/clearallbricktype - clears all matching bricks on the server based off of the datablock of your ghost brick
function serverCmdClearBrickType(%client)
{
if(!isObject(%client.player) || !isObject(%client.brickGroup) || !isObject(%client.player.tempBrick))
{
messageClient(%client, '', "<color:ffffff>To clear all bricks of a type, you need a ghost brick of the type you wish to clear.");
return;
}
%datablock = %client.player.tempBrick.dataBlock;
%count = 0;
for(%i = %client.brickGroup.getCount() - 1; %i >= 0; %i--)
if(%client.brickGroup.getObject(%i).dataBlock $= %datablock)
{
%client.brickGroup.getObject(%i).delete();
%count++;
}
if(%count == 1)
messageClient(%client, '', "<color:ffffff>1 brick of type" SPC %datablock SPC "have been cleared.");
else
messageClient(%client, '', "<color:ffffff>" @ %count SPC "bricks of type" SPC %datablock SPC "have been cleared.");
}
function serverCmdClearAllBrickType(%client)
{
if(!%client.isAdmin || !isObject(%client.player) || !isObject(%client.brickGroup) || !isObject(%client.player.tempBrick))
{
messageClient(%client, '', "<color:ffffff>To clear all bricks of a type, you must be an admin and need a ghost brick of the type you wish to clear.");
return;
}
%datablock = %client.player.tempBrick.dataBlock;
%count = 0;
for(%j = 0; %j < mainBrickGroup.getCount(); %j++)
{
%brickGroup = mainBrickGroup.getObject(%j);
for(%i = %brickGroup.getCount() - 1; %i >= 0; %i--)
if(%brickGroup.getObject(%i).dataBlock $= %datablock)
{
%brickGroup.getObject(%i).delete();
%count++;
}
}
if(%count == 1)
messageClient(%client, '', "<color:ffffff>1 brick of type" SPC %datablock SPC "have been cleared.");
else
messageClient(%client, '', "<color:ffffff>" @ %count SPC "bricks of type" SPC %datablock SPC "have been cleared.");
}
haven't been able to test the /clearallbricktype command
edit: oh, torque does support bool ? true : false syntax, was getting a syntax earlier and took it out, but it was actually being caused by issues with brick.datablock instead of brick.dataBlock