How can I get the Player Score to show in a custom book?
I'm creating a map that has some sort of RPG statistics, and I want them to be shown in a book for the player to see his personal stats.
Is it possible to do that?
And, if so, do the stats update automatically?
The syntax for objectives in raw JSON is:
{"score":{"name":"<name>","objective":"<objective>","value":"[value]"}
From the wiki:
score: A player's score in an objective. […]
name: The name of the player whose score should be displayed. […]
objective: The internal name of the objective to display the player's score in.
value: Optional. If present, this value is used regardless of what the score would have been.
The following command will give a book titled "SomeTitle" by "SomeAuthor" to the nearest player with a single page containing the nearest player's score for someObjective:
give @p written_book{pages:["[\"\",{\"score\":{\"name\":\"@p\",\"objective\":\"someObjective\"}}]"],title:SomeTitle,author:SomeAuthor}
However, this will not automatically update if the score changes.