How can I test for a filled area?

What I want to do is detect if any block of a wall is broken. At the moment, I have 1 command block for 1 block of the wall. This means I need several command blocks to see if any block of the wall is broken and I was wondering if there is anyway to do that with 1 command block instead? I'm in 1.12.


Solution 1:

You can build a copy of it (or clone it) in a secure area. Then you get the lowest and the highest x, y and z coordinates of the wall (that form a box around it) and the lowest x, y and z coordinate of your copy. Then you do:

/testforblocks <x y z low> <x y z high> <x y z of copy>

A comparator will be on/a conditional command block will be executed, if the two areas are the same.

You can see the formal syntax and a more detailed explanation of the command here (archive).