This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Drikdrok's profile picture

Get Scoreboard Value?

Started by Drikdrok, 19 July 2015 - 02:07 PM
Drikdrok #1
Posted 19 July 2015 - 04:07 PM
Hello. I have just now tried the command computers, and I love them.
But. I have not been able to find anything about getting/pulling a scoreboard value.

What would the command be? My guess would be somthing like this:
commands.exec("scoreboard players (get) (player) (objective)")
KingofGamesYami #2
Posted 19 July 2015 - 09:01 PM
commands.exec returns the text you'd see in chat. So if you can normally get values from the scoreboard, you can get it with a command computer (although you may need to use some string commands to parse it).
HPWebcamAble #3
Posted 19 July 2015 - 10:00 PM
Its possible, but it isn't really simple.

The only way I've found to get the score of a player in chat is with this command:

/scoreboard players add <player> <objective> 1
That outputs this:

Set score of <objective> for player <player> to <new score>
(You could use a pattern to get the score)

After you've gotten the output from the first command, you'd just remove one from their score.
Edited on 19 July 2015 - 08:01 PM
Drikdrok #4
Posted 24 July 2015 - 12:04 PM
Thanks!
Edited on 24 July 2015 - 10:04 AM