Scoreboard: i criteri che tracciano le cose automaticamente e gli slot di visualizzazione
La maggior parte dei tutorial sulle scoreboard usa solo dummy. I criteri integrati tracciano morti, blocchi scavati e statistiche personalizzate senza alcun comando — ecco la panoramica completa.
dummy is the criterion everyone learns, and it is the one that does nothing on its own. The interesting ones update themselves.
Creare un obiettivo
/scoreboard objectives add Deaths deathCount "Times died"
deathCount is the criterion. The quoted part is the display name and is optional.
Criteri ad aggiornamento automatico
| Criterio | Si incrementa quando |
|---|---|
deathCount | il giocatore muore |
playerKillCount | uccide un giocatore |
totalKillCount | uccide qualsiasi cosa |
health | continuamente — da 0 a 20 |
food, air, armor, xp, level | continuamente |
dummy | mai — solo /scoreboard players set |
trigger | mai, ma i giocatori possono modificarlo tramite /trigger |
trigger is the useful one for menus: a normal player cannot run /scoreboard players set, but they can run /trigger, which lets you build clickable menus that work without op.
I criteri statistici sono una risorsa infinita
/scoreboard objectives add Mined minecraft.mined:minecraft.diamond_ore
/scoreboard objectives add Walked minecraft.custom:minecraft.walk_one_cm
/scoreboard objectives add Jumps minecraft.custom:minecraft.jump
Qualsiasi statistica già tracciata dal gioco può gestire un obiettivo, senza alcuna funzione periodica. Le famiglie sono minecraft.mined, minecraft.crafted, minecraft.used, minecraft.broken, minecraft.picked_up, minecraft.dropped, minecraft.killed, minecraft.killed_by and minecraft.custom.
Nota che quelle relative alla distanza sono in centimetri — walk_one_cm divided by 100 is blocks.
Slot di visualizzazione
/scoreboard objectives setdisplay sidebar Deaths
/scoreboard objectives setdisplay list Deaths
/scoreboard objectives setdisplay below_name Deaths
sidebar— il pannello a destra, le prime 15 vocilist— accanto ai nomi nell'elenco tabbelow_name— fluttuante sotto la targhetta del nome del giocatore
La barra laterale accetta anche un suffisso con il colore della squadra — sidebar.team.red — showing that objective only to players on that team. That is how one server shows different scores to different teams.
Leggere un valore in un comando
/execute store result score @s Temp run data get entity @s Pos[1]
/execute if score @s Deaths matches 5.. run say five or more
matches takes a range: 5, 5.., ..5, 1..10. This is the standard way to branch on a score, and it is why store result matters — it is the bridge between world data and scoreboard arithmetic.
Pulizia
Gli obiettivi persistono per sempre nel file del mondo. /scoreboard objectives remove <name> when a map is finished, otherwise a heavily-iterated datapack leaves dozens of dead objectives that still tick.
Ogni gamerule con il suo valore predefinito, oltre alle statistiche delle scoreboard e alle frequenze degli eventi di gioco, è elencata in Riferimenti e calcolatori — Set 4.