4

How would I testfor if a point gets added to a scoreboard, and not when it reaches a certain point? Example, if score x goes up to 5 points, how would I testfor if it went up to 6 WITHOUT having a timer testing for score_x_min=6?

1
  • Fill clocks aren't evil, and they won't severely lag a server. Redstone dust is evil, and should never ever be used for clocks in maps. Really, the only reasonable solution is to use a fill clock.
    – MBraedley
    Mar 7, 2015 at 2:43

1 Answer 1

1

You can't do this without using a clock. At least, it can't be done reliably without a clock. If you know when the scoreboard changes (i.e. if it's incremented every time a pressure plate is pressed), then you might be able to run the check along side the command that changes the scoreboard value, but often this isn't the case. If not, then your only real choice is to use a clock.

And this is really something that should be on a clock anyway. Maybe even the fastest clock available. A fill clock. If you are using command blocks in a map, then there is no reason at all for using anything other than fill, setblock, and falling sand clocks. Your apprehension to using a clock or timer is probably because traditional redstone clocks caused a lot of server lag. But redstone dust itself is evil, and not the clock it made up. Fill clocks do introduce some lag, but it's not nearly as much as traditional redstone dust clocks. At this point, pretty much every command block heavy map runs on fill clocks. If you are making a map that uses at least a dozen command blocks, you're probably going to need a fill clock.

So, now that I've hopefully established that you really do need a clock, and that it should probably be a fill clock, let's get to the solution. In a command block that will be triggered by the clock, use the command testfor @a[score_x_min=6] and use a comparator to output a success to another command block. Alternatively, if you want to run a command that takes a player or entity as a variable, simply have that command be in a command block triggered by the clock.

2
  • Yes, I am a big fan of the fill clock, and the only reason I would need to be able to test for when a score is updated is non-dummy scores, such as stat.TalkedToVillager or something like that. What I think I might do is just have a command block running on a clock and when the score updates I'll have command blocks do what they need to do, and then reset the score back to 0. Thanks for the help though.
    – thezi3
    Mar 7, 2015 at 17:25
  • Resetting a score to 0 is very common. If you need to track both changes to a score as well as the total at the end, you basically need to have 2 scoreboard objectives. There might be ways now to do this without resetting, but I haven't explored that (and you still need 2 objectives).
    – MBraedley
    Mar 7, 2015 at 18:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .