Skip to content

An overview of documents

Anu Vogelat edited this page Aug 11, 2020 · 4 revisions

Original version by Ovokalia

A document is a type of Extended object that can be displayed via a workflow, allowing you to display pages containing text and images.

Example

Example document

Introduction

A document is created in the same way as a regular Total RP 3 profile. You can set the size of the document, choose from a variety of backgrounds, insert images and icons, and use the link tag to add links to websites (by specifying the URL) or call workflows (by using the workflow name). The workflow in question has to be contained in the document, but from this workflow you can execute the "Run Workflow" effect to call workflows elsewhere in your hierarchy. Text tags cannot be nested, doing so will result in raw HTML being displayed instead of the document.

A document can have multiple pages, and you can add links to workflows using the link tag, but instead of a URL you use the workflow name.

Dynamic documents

You can use variable tags to make a document dynamic, by setting the value of the variable in a workflow (provided the workflow is contained in the document and the variable source is set to Object, or the document is part of a campaign and the variable source is set to Active Campaign).

The document editor On the right, the editor. On the left, the document view.

In the example above we have the documentChallenge and documentAccept variables. The first will be set if we can challenge another player, the other will be set if we are challenged by another player. In this case only the documentChallenge is set, which means only that icon and link appear.

Refreshing documents

The variable value will only change when the document is next refreshed, but you can add a sequence of "Close document"/"Open document" to seamlessly refresh the document view if the workflow changing the variable is to be called while the document is displayed.

A workflow example Variable operations followed by a document view refresh.

In this workflow we first reset documentChallenge and documentAccept to an empty field, and then conditionally fill them. In this case the state is UNSTARTED so only documentChallenge will be set. At the end of setting all the variables the document is closed and reopened in order to make sure that it is refreshed. Putting this workflow in the campaign allows any object to refresh the document whenever some value changes.

Linking workflows to documents

Document events

Possible events of a document that can be linked to workflows.

There are two events that can be linked to a workflow from a document: open and close. This is done in the "Event Links" tab of the document creation. The run workflows are inside the document, but as usual you can have these contain a "run workflow" and run a workflow in the campaign instead, if desired.