Skip to content

Gamebook functions

Functions for the Gamebook game type (see Creating a gamebook), defined in GamebookCore.aslx. Most of them are only available in gamebooks. AddPageLink, RemovePageLink and HasSeenPage also work with Pages in a text adventure, along with ShowPage, which is listed under user interface functions.

AddPageLink (object source, object destination, string text)

Adds an option to source linking to destination, displayed as text. If a link to that destination already exists, it’s replaced. See also RemovePageLink and DoPage. There’s also an AddPageLink for Text Adventure dialogue pages, which works the same way.

ChangeCounter (string counter name, integer value)

Adds value to the named counter (a game attribute), treating a not-yet-set counter as starting at 0. value can be negative. See also IncreaseCounter, DecreaseCounter, SetCounter.

DecreaseCounter (string counter name)

Decreases the named counter (a game attribute) by 1, treating a not-yet-set counter as starting at 0 (so the result is -1). See also IncreaseCounter, ChangeCounter.

DoPage (object page)

Displays a gamebook page: prints its picture and description, moves the player to it (for room-type pages), and shows its options. This is the core of the gamebook page-turning mechanism - the Text Adventure equivalent for NPC dialogue trees is ShowPage.

HasSeenPage (object page)

Returns a boolean - true if the given page has been visited before (its visited attribute), for conditional page text or options based on what the player has already seen. There’s also a HasSeenPage for Text Adventure dialogue pages, which works the same way.

IncreaseCounter (string counter name)

Increases the named counter (a game attribute) by 1, treating a not-yet-set counter as starting at 0 (so the result is 1). See also DecreaseCounter, ChangeCounter.

MovePlayer (object destination)

Moves the player to destination. Equivalent to player.parent = destination.

RemovePageLink (object source, object destination)

Removes the option (if any) on source that links to destination. See also AddPageLink. There’s also a RemovePageLink for Text Adventure dialogue pages, which works the same way.

SetCounter (string counter name, integer value)

Sets the named counter (a game attribute) to value. See also IncreaseCounter, DecreaseCounter, ChangeCounter.

SetFlagOff (string flag name)

Sets the named flag (a boolean game attribute) to false. See also SetFlagOn.

SetFlagOn (string flag name)

Sets the named flag (a boolean game attribute) to true. See also SetFlagOff.