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

Book

const Book: object

Defined in: client/api.d.ts:3421

Books a resource composes and opens in this player’s hands.

A book is shown through the game’s own reading: the same book in hand, camera, page-turn animation, prompts and pagination as any book the player reads from their inventory. The player turns pages and leaves it with the game’s own keys, and bookClosed says when they did.

Client-only and local: the book exists on this machine alone, and reading it grants nothing – no XP, no read marker, no quest progress. A server that wants a player to read something sends the pages in its own event.

Pictures a resource ships go through Book.image, which returns what an <img src> and the texture option take.

close(): boolean

Closes the open book the way the player’s own exit does.

boolean

False when no book is open.

getLastError(): string

Why the last open returned null.

string

Empty after one that succeeded.

getOpenBook(): number | null

The id of the book in the player’s hands.

number | null

Null when there is none.

image(path): string

Makes a picture the resource ships reachable from page text.

string

A .dds file the calling resource ships, relative to the resource.

string

The value for an <img src='...'> attribute. Give the tag a width and height too: the movie sizes the picture to them and has no size of its own for it. Throws when the file is missing, not a .dds, or larger than 16 MiB.

open(options): number | null

Opens a book in the player’s hands.

BookOptions

The pages and how they look.

number | null

The book’s id, which bookOpened and bookClosed carry; null when the game will not open one now – no body yet, a book already open, or a place the player cannot read in (on horseback, in combat). getLastError says which. Malformed options throw.

setLegibility(value): boolean

Changes how legible the open book is, while it is in the player’s hands.

number

0 fully scrambled to 1 fully legible; clamped.

boolean

False when no book is in the hands yet (wait for bookOpened). The movie applies legibility while laying the text out, so the book is laid out again, which can return it to its first page. Throws for a non-number.