Skip to content
KCKingdoms Connected Scripting APIScripting guides and API
Global objectServer APIGenerated

Dialogue

const Dialogue: object

Defined in: server/api.d.ts:2685

Conversations the server drives on a player, in the game’s own dialogue list.

A conversation is attached to nothing. It runs on a player and what it is about – a smith, a notice board, a chest, a timer – is this gamemode’s own business, held in its own closures. That is deliberate and it has a cost: nothing here watches distance, line of sight or whether anyone died, because none of that is knowable without the relationship it refuses to hold. Close the conversation yourself when the fiction says it should end.

close(session): boolean

Ends a conversation and takes the list off that player’s screen.

number

The session to end.

boolean

False when the session had already ended.

open(player, page): number

Opens a conversation and shows its first page. A player already in one has it closed with reason 2 first, because the game has a single choice list and stacking them would lie about which is live.

number

NetworkID of the player the conversation runs on.

DialoguePage

The first page. options is required and carries at most 8 rows; each needs an id and a text, and may set enabled. line and onRight are optional.

number

The session id, or 0 when the page was unusable or the player is gone.

sessionOf(player): number

The conversation that player is in.

number

NetworkID of the player to ask about.

number

The session id, or 0 when they are not in one.

update(session, page): boolean

Replaces the page a live conversation is showing. Each page carries a generation the client echoes, so an answer still in flight against the page this replaces is dropped rather than misapplied.

number

The session to advance.

DialoguePage

The page to show instead.

boolean

False when that session has already ended.