How do you test if score A is larger than Score B (different scoreboard objectives)?
I am working on a LVL requirement system, and to do that I need to be able to compare 2 scoreboard objectives. I have been playing around with some ideas and I am still unsure on how to do it. If you can help me that would be great!
So basically I am trying to test if a player is holding an item with custom NBT that sets a higher level (achieved through a scoreboard command) than the players set LVL (again a scoreboard). I have tried /scoreboard players operation @p[Score_Tested_min=1] LVL1 -= @p[Score_Tested_min=1] lvl1
Obviously it would be hard to explain the complicated setup I have. But basically LVL1 and lvl1 are based on other objectives and the tested thing is a selector so it only works on one player per a tick.
Best Answer
Maybe a little late, but in the new 1.13 commands, target selectors support ranges. So after you've done the substraction, and gave the player that should be affected the substracted score, you can use scores={(your score)=1..} for greater than, and instead of 1.. ..-1 for less than in the target selector...
Pictures about "How do you test if score A is larger than Score B (different scoreboard objectives)?"
How do you test scoreboard?
The correct syntax for score selectors is /testfor (player)[scores={objective=number}] . However that command only selects one number. To select a minimum number you need to use a scoreboard test.How do you test a score in Minecraft?
Score is determined solely by the amount of experience you've collected since your last death. It is not how much experience you have when you die - experience you've spent still counts. For example, if you collect 50 experience, then spend 25 of it, your score is 50, not 25.How does the score system work in Minecraft?
Scoreboard CommandStandard Scores
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Sides Imagery, Engin Akyurt, Mike, Joe Calomeni