%boxsize is "x y z" in torque units, %position is the exact center of the box. %mask is the typemask/s of whatever object type/s you want to look for. possible typemaks are $typemasks::fxbrickobjecttype, $typemasks::playerobjecttype, $typemasks::vehicleobjecttype, etc. you can just type $typemasks:: in the console and hit tab to see them all ;)
initContainerBoxSearch(%obj.getposition(),"3 3 3",$typemasks::fxbrickobjecttype);
while(%target=containersearchnext()){
echo(%target);
}
this would echo the id of every brick in a 3x3x3 box around %obj ;)
edit: if you want to search for more than one typemask, just put a | between them, ex. $typemasks::fxbrickobjecttype | $typemasks::playerobjecttype | $typemasks::vehicleobjecttype