Hey Everyone!
This is going to be an introduction to the skRayFall scoreboard system and the many ways it can be used. skRayFall's scoreboards were designed to cover a wide range of use cases and as such its usage can be divided into multiple usecases.
In Minecraft the sidebar/scoreboard typically refers to the information box on the right side your screen that can look like this:
For simplicity since Minecraft has many types of scoreboards we will refer to this as the "sidebar".
In showing any sidebar in Minecraft you must first set the title of the sidebar for the player using Set Sidebar Name:
set name of sidebar of %player% to %string%
After this is set, a variaty of techniques can be used to display different information to users or groups of users.
To remove or clear a scoreboard the effect Wipe Sidebar can be used:
(wipe|erase|delete) %player%['s] sidebar
So to get started here is a very simple example using simple scores:
command /helloscoreboards:
trigger:
set name of sidebar of player to "&6Hello Scoreboards!"
set score "My Score:" in sidebar of player to 0
wait 10 seconds
wipe player's sidebar
Which will look like:
Note: Scoreboards will order the scores based on the score value in descending order, not the order they were added to the scoreboard!
For example:
command /orderexample:
trigger:
set name of sidebar of player to "&6Hello Scoreboards!"
set score "I'm second!" in sidebar of player to 1
set score "I'm first!" in sidebar of player to 0
wait 10 seconds
wipe player's sidebar
Now let's get into the different sidebar score types!
These are scores that can be set and forgot. You will not be able to update any of these scores once they are set but they can be wiped. This is great for setting info quickly that doesn't need to be changed.
The syntax element for this is Set Sidebar Score:
set score %string% in sidebar of %player% to %number%
Here is another example using simple scores:
command /simpleexample:
trigger:
set name of sidebar of player to "&6Simple Example 1"
set score "&aHello %player%!" in sidebar of player to 2
set score "&aThis is a simple score!" in sidebar of player to 1
wait 5 seconds
wipe player's sidebar
set name of sidebar of player to "&6Simple Example 2"
set score "&dYou must set the sidebar name again!" in sidebar of player to 3
wait 5 seconds
wipe player's sidebar
Now lets say you want to update or remove a score. This can be done by using ID based scores, using ID based score will allow you to reference a single score in a scoreboard. ID's are shared across all users and can be over written while setting them, but you will lose the reference to the original score. So try to avoid ID collisions by using the players name in the ID name. To set an ID based score use Set ID based Score:
(set|create) id [based] score %string% in sidebar of %player% to %number% with id %string%
To edit an ID based score use Edit ID based score:
(edit|update) score [with] id %string% to %string% and %number%
To remove an ID based score without resetting the scoreboard use Delete ID based score:
(delete|remove) score [with] id %string%
To reference the scores name/title or value use these expressions Single ID Score Value:
score (name|title) (of|from) id %string%
score (value|number) (of|from) id %string%
Here is an example that brings everything together:
command /idexample:
trigger:
set name of sidebar of player to "&6ID Example"
set id based score "&aThis is an ID score!" in sidebar of player to 3 with id "%player%.id1"
set id based score "&dThis will update!" in sidebar of player to 0 with id "%player%.id2"
wait 5 seconds
update score with id "%player%.id2" to "&aUpdated!" and 2
set {_title} to score title of id "%player%.id2"
set {_value} to score value of id "%player%.id2"
message "%{_title}% - %{_value}%"
message "&fNow lets remove it!"
wait 5 seconds
remove score with id "%player%.id2"
wait 5 seconds
# Will clear all ID's in the player's scoreboard
wipe player's sidebar
Now lets say a group of people need to have the same score shown to them. Such as a team game or in a lobby. This can be done by using the group ID based scores. Much like ID based scores, but in this case you can set/update/delete the same score for a group of users. ID's are shared globally by not with Single ID Based Scores.
To create an group ID based score use Create Group Based Score:
(set|create) group id [based] score %string% in sidebar for %player% to %number% with id %string%
To add/remove a player to a group ID based score use Add/Remove Players from Group Scores:
add %player% to group score [with id] %string%
(delete|remove) %player% from group [id based] score %string%
To update a group ID based score use Set Below Name Score:
(edit|update) score [with][in] group [id] %string% to %string% and %number%
To remove an group ID based score without resetting the scoreboard use Delete Group Score:
(delete|remove) score[s] [with] group id %string%
To reference the score's name/title or value use these expressions Group Score Value:
group score (name|title) (of|from) id %string%
group score (value|number) (of|from) id %string%
Here is an example that brings everything together:
command /groupexample:
trigger:
set name of sidebar of player to "&6Group Example"
create group id score "&aGroup Score" in sidebar for all players to 5 with id "all_players"
wait 5 seconds
update score in group id "all_players" to "&aUpdated Group Score" and 6
set {_title} to group score name of id "all_players"
set {_value} to group score value of id "all_players"
message "%{_title}% - %{_value}%"
message "&dLets remove you from the group"
wait 5 seconds
remove player from group id based score "all_players"
message "&dLets add you back group"
wait 5 seconds
message "&dLets delete the group"
add player to group score with id "all_players"
wait 5 seconds
set score "&fSimple Score" in sidebar of player to 0
remove scores with group id "all_players"
wait 5 seconds
# Will remove the player from all group scores
wipe player's sidebar
Never use a while loop or every x event to update scoreboards!
# DO NOT EVER DO THIS!
every tick:
loop all players:
wipe loop-player's sidebar
set name of sidebar of loop-player to "&6My Server"
set score "&a{%loop-player%::value}!" in sidebar of loop-player to 1
This will slow things down on your server and possibly cause lag. Only update a scoreboard when the value/title has changed using an ID based score.
These three system should cover almost all uses cases for sidebar scoreboards. skRayFall also supports several other types of scoreboards that will be covered in a later tutorial.
You must be logged in to comment
March 22, 2022, 6:44 p.m. - Gab ¶
just use skbee