#how to store scoreboards and command outputs to a variable

14 messages · Page 1 of 1 (latest)

vale cloud
#

eg: i have a scoreboard with the value of 82. a variable will always be equal to the value of the scoreboard (82).

barren garnetBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

rich shadow
#

Command outputs are always 1 or 0 to indicate if it’s successful or not, is that what you want to save?

untold cairn
#

Commands have both a boolean 'success' value and a 'result' value which I assume is what they want. See the /execute store command

vale cloud
#

ik about execute store

#

but execute store stores to a scoreboar

#

i want to turn that scoreboard into a variable

untold cairn
#

Yes, sorry, I was responding to Lexxie
If I were you I would just not use scoreboards and try to rewrite it just in code, if that's possible at all.

vale cloud
#

yeah im much more familiar with commands than all this js stuff lol

untold cairn
#

I've worked a lot with commands, and code is a lot more powerful and easier in the end. You don't have to faff around the same you do with commands. Only tradeoff is you might have to hunt for methods to call
So you can access the scoreboard with server.scoreboard
I'm struggling to figure out exactly what methods gets you a specific score though

#

Okay I think you want server.scoreboard.getPlayerScores('player_name').ObjectiveName
Alternatively, server.scoreboard.getPlayerScores('player_name')[server.scoreboard.getObjective('objective_name')]

#

And then you might need to call .getScore() on that to get the numeric value

vale cloud
#

ok

barren garnetBOT
#

@vale cloud Unresolved thread still hasn't been closed! If your question was answered, please close this post with </ticket close:1054771505520717835> command!