Scoreboard Values Library - TheBaruch4/DataUtils GitHub Wiki

The Scoreboard Values Library is a very simple part of this data pack, yet it can make life a lot easier when you're doing math and comparisons with scoreboards.

What is it?

The Scoreboard Values Library will automatically create a scoreboard objective called "svl_value". Within this scoreboard objective, 2001 "players" are created automatically, with their scores matching their names. For example, the player "1" has a score of "1". The player "2" has a score of "2". The player "483" has a score of "483". This continues up to player "1000" having a score of "1000". As of release 0.1.0 and later, all integers from -1000 to 1000 are supported by this feature.

So why is this useful?

Scoreboard Values Library can be very useful when using the scoreboard players operations command. Normally, if you wanted to multiply the score of "PlayerUsername" by 5, you'd have to do something like this:

  • Create a "player" on a scoreboard somewhere (in this example, "NotARealPlayer")
  • Set that "player"'s score to 5 (or whatever you want to multiply the score by)
  • Run these commands
    • scoreboard objectives add ThisIsAScoreboard dummy
    • scoreboard players set NotARealPlayer ThisIsAScoreboard 5
    • scoreboard players PlayerUsername ScoreboardName x= NotARealPlayer ThisIsAScoreboard

But, using this data pack, all you'd need to do would be:

  • Run the command scoreboard players PlayerUsername ScoreboardName x= 5 svl_value

Yes, it's that easy!