The Meaning of Life, the Universe, and Everything.
Not exactly a redstone logic question, but this seemed like the best place for this. I'm wondering if there's any way to reset a Command Block that is outputting to a comparator without running the command again. What I want to do is:
Press a button.
Activate a Command Block with a testfor command.
Output a short pulse from the Command Block if testfor is successful.
Press the button again.
Have testfor succeed again, tripping the circuit a second time.
The trouble I'm having is that once the Command Block successfully executes a command, the comparator turns on. It then remains on forever until the command is run again and fails. So, for instance, if my Command Block had the command: testfor @p[r=3]
And one were to push the button while standing 2 blocks away, and the output activates a Dispenser, it spits out an item. My whole circuit looks like this:
If I press the button a second time, nothing happens because the comparator never turned off. I want it to dispense every time the button is pressed and the testfor command is successful (i.e., I want the comparator to send out a pulse instead of just staying on, because it jams up the circuit). Just curious if that's possible.
The way it's set up, it seems like I would have to step back to 4 blocks away from the Command Block, press the button so the command fails, and then step closer and press the button again. That's really asinine, and could cause a lot of unwanted results in other circuits where running the command a second timewould actually do something to effect the world (teleport a player, change a scoreboard score, etc). I realize I could just hook up an AND gate with the button and my comparator as the inputs, but that makes it occupy more space than I'd like it to and doesn't really excuse it for being asinine. Just wanted to know if there's some other way. Maybe Mojang should add a tickbox on the Command Block interface that would let you configure whether the output stayed on or sent a pulse. I would like that.
Sadly this does not refresh the command block. The only way to execute a command twice while the statement is true is to make the statement false. Another way of putting it is once the statement is true the comparator will stay active until the command is false. This causes the comparator to stay active, not allowing us to make the same two commands.
In order to get this to work as the OP wanted, we want a solution where the comparator will check to see if the command block is true and will emit ONE pulse so it can check for the same command. I'm so close to a World Guard system using Scoreboard/command blocks but because the comparators are staying active, it only works with two people. If anyone knows how to emit one pulse from the comparator that would be Freaking awesome.
If i run into anything, i'll post and update. Also this post was for more clarification.
is it possible to do reset the comparator if strictly using Radius?
It's always possible to reset a comparator by powering the side.
Quote from Minecraftwiki »
The Redstone Comparator (pronounced kəmˈparətər) is a block for use with redstone circuitry. It has two inputs: one from the back ('signal A') and one from the side ('signal B'). If signal B is stronger than signal A, there will be no output
This means that as long as the signal going in on the side is greater than the signal strength from the command block it will reset until the command runs again.