ai-scoreboard for developers
ai-scoreboard has no exports. What it reads from AI Core and the events it uses internally.
ai-scoreboard has no exports and no events meant for other scripts. Everything it shows comes from AI Core, so you change the board by changing AI Core's data:
- Players and names come from loaded characters (lib
onCharacter,online.name). - On-duty counts come from AI Core's duty state (lib
online.onDutyFor, GlobalStateai:duty:<job>). A player counts as soon as AI Core puts them on duty (SetDutyexport, or a bridge script's duty event). See ai-core server exports.
If you want the same numbers in your own script, read them from AI Core, not from the scoreboard:
// Client side: the on-duty police count, the same number the scoreboard shows.
const police = Number(GlobalState["ai:duty:police"] ?? 0);
console.log(`${police} police on duty`);Internal events
These names belong to ai-scoreboard's own client and server. They are listed so you recognize them in logs; do not call them from other resources.
| Name | Kind | What it carries |
|---|---|---|
ai-scoreboard:board | Client to server callback | Answers the counts shown right now (asked on each key press, rate limited). |
ai-scoreboard:subscribe | Client to server callback | Subscribes the player to the player list. A full list follows once, then only changes. |
ai-scoreboard:client:roster | Server to client (latent) | (seq, rows): the whole player list. |
ai-scoreboard:client:changes | Server to client | (seq, puts, removes): players who joined or left, at most once a second. |