Take the 2-minute tour ×
Arqade is a question and answer site for passionate videogamers on all platforms. It's 100% free, no registration required.

I am trying to do something with command blocks. I have it test for a player at a certain position. I have set up a hopper clock that activates a command block with

/testfor @a[x=-611,y=80,z=714]

For some reason, no matter where i stand, the command block will always produce a redstone signal. Even though when I check the "last output" it says that the player can't be found.

I think I figured it out, the redstone comparator is picking up a signal from the block like its a regular block, but I do not know how to fix this.

Screenshots (open in new tab to enlarge):

onetwo

share|improve this question
    
Did you try @p instead of @a –  kingbluesapphire Jun 24 at 6:12
    
@kingbluesapphire yes i tried @p and it remains on even though it says the player can't be found. –  mdlp0716 Jun 24 at 13:38
    
How often does the clock power the block? I don't think the comparator should de-power until the block checks again. –  Tom Hart Jun 24 at 14:06
    
I took the liberty of improving the readability of your question. Feel free to roll back if you don't like it, though. I am unsure as to what you mean in your Update. From where does the command block pick up the signal? Is there other redstone that is not visible in the screenshots? Does the output blink, or is it permanently on? –  MrLemon Jun 24 at 14:10
    
thank you for editing the question @MrLemon. what i mean is like when you put a redstone signal into a block, the block will have a LOW redstone power so that redstone repeaters and comparators can pick it up, so what i mean is that i THINK the redstone comparator is picking up the redstone signal not from the command block, but from the redstone powering the command block. –  mdlp0716 Jun 24 at 14:31

3 Answers 3

When using coordinates, you need to specify a radius so that it knows how far to search from that specific point. Try changing your command to:

/testfor @a[x=-611,y=80,z=714,r=1]

You can also compact it down into:

/testfor @a[-611,80,714,1]

I believe that the reason is that without a radius the selector makes no sense, so it is simply ignored and tests for @a.

share|improve this answer
    
This is not an answer to the question. The command works fine (or not, doesn't matter), the problem is that the comparator outputs a signal, even if the command itself failed. –  MrLemon Jun 24 at 14:28
    
@MrLemon This is a completely working answer to the question. Try it out if you do not believe me. When a command fails because of incorrect syntax, it does not correctly update the output. –  colorfusion Jun 24 at 14:50
    
Okay, I did not know that. I suggest you edit it into the answer, to avoid confusing more people than just me. Also, I can't remove the downvote without an edit. –  MrLemon Jun 24 at 15:58
    
i think the command was working, wouldn't it have said something like "invalid syntax" in the previous output box if it wasn't correct? –  mdlp0716 Jun 24 at 17:29
1  
@mdlp0716 It seems that if the selector arguments are incorrect, it just ignores them. No error message. Try it out with something like /testfor @a[wahwawghawgawg], it'll find you even though it's invalid syntax. –  colorfusion Jun 24 at 17:40

Connect the comparator output to a command block with the following command:

/blockdata x y z {SuccessCount:0}

where x, y, and z are the coordinates of the first command block

This happens because the comparator outputs if the command block has ever successfully executed the command. By using the blockdata command, you set the successful-execution-of-command counter of the command block to 0, making the comparator turn off

sorry for my english :(

share|improve this answer

If you write a wrong command like "testfor @a[asdsfa]" it will be "testfor @a" so it will search all the map and find you so comparator will powered "testfor @a[, , , r=]" try this

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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