Skip to main content

Emitted events

:::info Copied from the repository This page is app.gap.Tsum/EVENTS.md, copied in by the site's sync step. Regenerate it there with npm run events:docs; edits here are lost at the next sync. :::

What this script broadcasts to tooling following a run, and what each event carries. The host defines none of it: emitEvent(name, data) hands a line to whichever consumers are attached, adding only a sequence number, a UTC timestamp and the script id. The transport, the two sockets and the wire format are the host's document -- ../game-automation-app/docs/EVENTS.md.

Names are declared once, in src/scriptEvents.ts, and reached through ts.emit(), which is silent on a host too old to have emitEvent.

5 event(s) from 5 call site(s).

eventemitted frompayload
round.oversrc/play.ts:367id, seconds
round.startsrc/play.ts:478id, round, myTsum, skill, settings
round.endsrc/play.ts:827id, round, seconds, score, baseCoins, finalCoins, medals, settings
run.startedsrc/index.ts:80version, skill, locale
run.stoppedsrc/index.ts:352rounds

The events

round.over

Emit.Round.Over — The board is finished and the score tally is beginning.

fieldtype
idstring
secondsnumber

Emitted from:

  • src/play.ts:367this.emit(Emit.Round.Over, …)

round.start

Emit.Round.Start — The pre-round screen is up with the bonus items set, and Start is about to be tapped. The signal to start recording -- emitted here rather than on the board so a recording opens on the items the round is being played with; the board follows a few seconds later. id is the round's own, repeated by every other round.* event of that round -- which is how a consumer several emulators dial into tells one round's events from another's, where round counts a single device's rounds and starts at 1 on each. It is also the CSV row's id. settings is what the round is being played under: the gameplay settings the stats CSV records as columns, as the settings object holds them.

fieldtype
idstring
roundnumber
myTsumstring
skillstring
settingsPartial<Settings> | undefined

Emitted from:

  • src/play.ts:478this.emit(Emit.Round.Start, …)

round.end

Emit.Round.End — The tally is done and the figures have been read. The signal to stop recording, and the only event carrying the round's numbers. settings repeats what round.start said, so this one event stands on its own.

fieldtype
idstring
roundnumber
secondsnumber
scorenumber | null
baseCoinsnumber | null
finalCoinsnumber | null
medalsnumber | null
settingsPartial<Settings> | undefined

Emitted from:

  • src/play.ts:827this.emit(Emit.Round.End, …)

run.started

Emit.Run.Started — A run has been asked for and its world is about to be built.

fieldtype
versionstring
skillstring
localeLocale | undefined

Emitted from:

  • src/index.ts:80emitScriptEvent(Emit.Run.Started, …)

run.stopped

Emit.Run.Stopped — The run's world has been dismantled; nothing is playing.

fieldtype
roundsnumber

Emitted from:

  • src/index.ts:352emitScriptEvent(Emit.Run.Stopped, …)