1

This question already has an answer here:

If I run this command which looks for a player at specific coordinates, I don't get any output.

testfor @a[X,Y,Z,r=1]

(X, Y, and Z are certain coordinates in my world.) This is quite important, because if I don't have a output, comparators can't tell if the command found any players.

Please Help, I'm not that good with command blocks.

marked as duplicate by Wolf, Young Guilo, angussidney, Riley, Merus Oct 3 '16 at 8:15

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3

During command processing, a selector is processed before the command itself is.

The first step is to determine whether or not the selector can target more than 1 entity before obtaining the targets. @a and @e both are capable of doing so, provided the c parameter is not set to 1.

The second step is split into two depending on the first step:

  1. If there's only 1 target possible (@p, @r, @a[c=1], @e[c=1]), the command class is executed without immediately processing the selector. The command class will process the selector itself. If the command fails, the error is returned accordingly.

  2. If there's more than 1 target possible (@a, @e, @p[c=2], @r[c=2]), the selector is processed and targets are obtained. For each target, the command is processed separately and the final error is returned.

But for the second part of step 2, if no targets were obtained, then no commands were executed and thus no errors were returned. There is not an error thrown for there having been no players obtained at all in that case, so the output is blank.


It's also possible that the command isn't activating properly, so its last output doesn't update.

A quick way to check if the command is activating is to force an output by setting c to 1 (satisfying the first part of step 2 above):

/testfor @a[X,Y,Z,r=1,c=1]

You will receive an "invalid UUID" error if no targets are found.

Not the answer you're looking for? Browse other questions tagged or ask your own question.