Book
constBook: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.
Type Declaration
Section titled “Type Declaration”close()
Section titled “close()”close():
boolean
Closes the open book the way the player’s own exit does.
Returns
Section titled “Returns”boolean
False when no book is open.
getLastError()
Section titled “getLastError()”getLastError():
string
Why the last open returned null.
Returns
Section titled “Returns”string
Empty after one that succeeded.
getOpenBook()
Section titled “getOpenBook()”getOpenBook():
number|null
The id of the book in the player’s hands.
Returns
Section titled “Returns”number | null
Null when there is none.
image()
Section titled “image()”image(
path):string
Makes a picture the resource ships reachable from page text.
Parameters
Section titled “Parameters”string
A .dds file the calling resource ships, relative to the resource.
Returns
Section titled “Returns”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()
Section titled “open()”open(
options):number|null
Opens a book in the player’s hands.
Parameters
Section titled “Parameters”options
Section titled “options”The pages and how they look.
Returns
Section titled “Returns”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()
Section titled “setLegibility()”setLegibility(
value):boolean
Changes how legible the open book is, while it is in the player’s hands.
Parameters
Section titled “Parameters”number
0 fully scrambled to 1 fully legible; clamped.
Returns
Section titled “Returns”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.