2

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

6
  • Did you try @p instead of @a Commented Jun 24, 2014 at 6:12
  • @kingbluesapphire yes i tried @p and it remains on even though it says the player can't be found.
    – mdlp0716
    Commented Jun 24, 2014 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.
    – TMH
    Commented Jun 24, 2014 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
    Commented Jun 24, 2014 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
    Commented Jun 24, 2014 at 14:31

4 Answers 4

2

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.

6
  • 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
    Commented Jun 24, 2014 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.
    – SirBenet
    Commented Jun 24, 2014 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
    Commented Jun 24, 2014 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
    Commented Jun 24, 2014 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.
    – SirBenet
    Commented Jun 24, 2014 at 17:40
1

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 :(

0

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

0

Comparators release a small signal to the first piece of redstone connected to it. The repeater is simply amplifying this signal. To fix, just make the repeater and the comparator a block or maybe two apart with redstone in the middle.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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