Well, a simple loop through all objects in the brick groups and a tally would work.
function countbricks()
{
if(!isobject(mainBrickGroup))return;
%numfounddata=0;
for(%i=0;%i<mainbrickgroup.getcount();%i++)
{
%group=mainBrickGroup.getobject(%i);
for(%j=0;%j<%group.getcount();%j++)
{
%data=%group.getobject(%j).getdatablock();
if(%found[%data])%found[%data]++;
else
{
%founddata[%numfounddata]=%data;
%numfounddata++;
%found[%data]=1;
}
}
}
if(%numfounddata)
{
for(%i=0;%i<%numfounddata;%i++)
{
echo(%found[%founddata[%i]] SPC %founddata[%i].uiname);
}
}
else echo("No bricks to search!");
}
Or if you want to show the numbers to everybody, replace the bottom bit with...
if(%numfounddata)
{
for(%i=0;%i<%numfounddata;%i++)
{
messageall("","\c2"@%found[%founddata[%i]]@" \c1"@%founddata[%i].uiName);
}
}
else messageall("","No bricks to search!");
}