Dialogue
constDialogue: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.
Type Declaration
Section titled “Type Declaration”close()
Section titled “close()”close(
session):boolean
Ends a conversation and takes the list off that player’s screen.
Parameters
Section titled “Parameters”session
Section titled “session”number
The session to end.
Returns
Section titled “Returns”boolean
False when the session had already ended.
open()
Section titled “open()”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.
Parameters
Section titled “Parameters”player
Section titled “player”number
NetworkID of the player the conversation runs on.
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.
Returns
Section titled “Returns”number
The session id, or 0 when the page was unusable or the player is gone.
sessionOf()
Section titled “sessionOf()”sessionOf(
player):number
The conversation that player is in.
Parameters
Section titled “Parameters”player
Section titled “player”number
NetworkID of the player to ask about.
Returns
Section titled “Returns”number
The session id, or 0 when they are not in one.
update()
Section titled “update()”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.
Parameters
Section titled “Parameters”session
Section titled “session”number
The session to advance.
The page to show instead.
Returns
Section titled “Returns”boolean
False when that session has already ended.