Jump to content




Get Scoreboard Value?

command

3 replies to this topic

#1 Drikdrok

  • Members
  • 4 posts
  • LocationWhat Location?

Posted 19 July 2015 - 03: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)")

#2 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 19 July 2015 - 08: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).

#3 HPWebcamAble

  • Members
  • 933 posts
  • LocationWeb Development

Posted 19 July 2015 - 09: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 by HPWebcamAble, 19 July 2015 - 09:01 PM.


#4 Drikdrok

  • Members
  • 4 posts
  • LocationWhat Location?

Posted 24 July 2015 - 11:04 AM

Thanks!

Edited by Drikdrok, 24 July 2015 - 11:04 AM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users