Skip to content

Building a conversation with Pages

The Tutorial covers the basics of setting up a Pages dialogue tree. This page covers some more advanced techniques once you’ve got the hang of it.

Quest Viva has several ways to let the player talk to a character - see Talking to characters for an overview. Pages are the right choice when you want a structured, multi-step exchange where each reply leads to a fixed set of further choices - the Text Adventure equivalent of a gamebook’s branching passages. For a one-off list of topics with no follow-up, a menu is simpler. For a free-form “ask about anything” system, use Ask/Tell instead.

Each choice is a complete, ordinary turn, so the player can save at any point in a conversation - see Menus, Pages and saving for how this compares with menus. (The player cannot type UNDO while the dialogue is waiting, because what they type is taken as their choice.)

A page is any object that inherits the dialoguepage type - normally created via “Add Page” in the tree, which sets this up for you along with the editor’s “Page” tab. Pages are invisible and not world-scoped, so they don’t clutter “look”, “take all” or disambiguation menus, and it doesn’t matter where in the tree you put them - directly under the character they belong to, or gathered together under a folder of their own.

Each page has:

  • a description - the text shown when the page is displayed
  • an options dictionary - the object name of each linked page, mapped to its link text
  • a page type - Text (just shows the description), Script (runs a script instead of showing any text or options), or Script + Text (runs a script, then shows the description and options as normal)

ShowPage starts a dialogue at a given page. Call it from wherever you want the conversation to begin - a verb, a command, an Ask/Tell topic, or a timer:

ShowPage (bob_chat, true, false)

From inside a page’s own script (Script or Script + Text page types), you can redirect to a different page with GoToPage - useful for skipping a page based on game state, the same way you might branch a SPEAK TO response:

if (not chest.locked) {
GoToPage (bob_chest_open)
}
else {
GoToPage (bob_chest_locked)
}

If a Script or Script + Text page’s script doesn’t redirect anywhere else, the dialogue simply ends once it’s finished running (for a plain Script page, without ever showing that page’s own description).

To start a conversation from a link in ordinary text - a room description, say, or an object’s “look at” description - use the {page:} text processor command. The Page button on the text editor’s toolbar inserts one, letting you pick the page and the link text:

Bob is leaning on the bar. You could {page:bob_chat:talk to him}.

Clicking “talk to him” starts the conversation at bob_chat. Once the link has been shown, typing the page’s name (bob_chat) does the same; before that, the page’s name isn’t a command the player can use.

A conversation started this way doesn’t let the player leave by typing another command - they’re asked to choose one of the options. So give it a way out, such as a “Goodbye” option leading to a page with no options. If you need different settings, use a command link to a command whose script calls ShowPage instead.

A page with an empty options list ends the dialogue automatically once it’s shown. To end things early from partway through a page’s own script - for example, some game state means this exchange should be cut short - call EndPageDialogue directly; it hides the current page’s options and clears the dialogue state before the option list would otherwise have been printed.

The editor’s Options list is the easiest way to set up a page’s links, but you can also add and remove them from a script, which is useful for a conversation that changes shape as the game progresses - for example, unlocking a new topic once the player has found some evidence. AddPageLink and RemovePageLink do this:

AddPageLink (bob_chat, bob_lab_report, "Ask about the lab report")

Calling AddPageLink again for the same source and destination replaces the existing link’s text rather than adding a duplicate. To remove an option later:

RemovePageLink (bob_chat, bob_lab_report)

Under the hood, options are stored in the page’s options attribute, a stringdictionary keyed by the destination page’s object name - AddPageLink/RemovePageLink are just a convenient wrapper around dictionary add/dictionary remove on that attribute, so you can fall back to those directly for anything more unusual.

To show an option only when something is true - “Ask about the lab report” once the player has found it, say - set the page’s type to “Script + Text” and add or remove the link in its script. The script runs every time the page is shown, before its options are listed, and this is the page:

if (Got(lab_report)) {
AddPageLink (this, bob_lab_report, "Ask about the lab report")
}
else {
RemovePageLink (this, bob_lab_report)
}

Added options appear after the ones set up in the editor. In the editor, these are “Add page link” and “Remove page link” in the Pages category.

HasSeenPage returns whether a given page has already been shown, based on its visited attribute, so you can vary a page’s script the second time the player reaches it - see the Tutorial for a worked example.