AI Core

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, GlobalState ai:duty:<job>). A player counts as soon as AI Core puts them on duty (SetDuty export, 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.

NameKindWhat it carries
ai-scoreboard:boardClient to server callbackAnswers the counts shown right now (asked on each key press, rate limited).
ai-scoreboard:subscribeClient to server callbackSubscribes the player to the player list. A full list follows once, then only changes.
ai-scoreboard:client:rosterServer to client (latent)(seq, rows): the whole player list.
ai-scoreboard:client:changesServer to client(seq, puts, removes): players who joined or left, at most once a second.

On this page