Documentation
LoreHub Dialogue System

Document version 1.1

Document 1.1 is Document v1 with more optional fields: the document's template, its parent and its field values. id and name are the same, and a document without a template, parent or values exports exactly as before, apart from apiVersion.

Schema

{
  "type": "@lorehub/document",
  "apiVersion": "1.1.0",
  "id": "031476c0-2504-4ed7-aa79-e5fce21e2091",
  "name": "Mira Voss",
  "templateId": "5f0c7a52-3e8e-4f5b-9a8f-0c3b6b1d9f10",
  "template": "Character",
  "parentId": "4a8e2d10-6c1f-4f0e-9d7a-2b5c8e3f1a77",
  "fields": [
    { "key": "age", "fieldType": "number", "value": "34" },
    { "key": "alive", "fieldType": "boolean", "value": "true" },
    { "key": "content", "fieldType": "richText", "value": "<p>Captain of the harbor watch.</p>" },
    { "key": "family", "fieldType": "documentList", "documentIds": ["9c3b7e21-5d4a-4b8f-a1e6-0f2d7c9b3e55"] },
    { "key": "home", "fieldType": "documentLink", "value": "4a8e2d10-6c1f-4f0e-9d7a-2b5c8e3f1a77" },
    { "key": "mood", "fieldType": "choice", "value": "Calm" },
    {
      "key": "portrait",
      "fieldType": "image",
      "value": "b8d1f7e4-0a52-4c39-8c1d-7f1e2a6c4b90",
      "framing": { "x": 30, "y": 50, "zoom": 2, "fit": "cover" }
    },
    {
      "key": "purse",
      "fieldType": "gameVariable",
      "role": "tracks",
      "gameId": "2377f69f-4c03-485a-8e08-de3bb6d7faf5",
      "variableIds": ["f7fbdcd0-60ac-407e-9239-bb3214119298", "3b0c3e4e-5b1c-4a55-8f0a-5f7d1d2a9b11"]
    },
    {
      "key": "unlock",
      "fieldType": "gameVariable",
      "role": "requires",
      "gameId": "2377f69f-4c03-485a-8e08-de3bb6d7faf5",
      "requiredVariables": [
        { "variableId": "3b0c3e4e-5b1c-4a55-8f0a-5f7d1d2a9b11", "value": "10", "operator": ">=" }
      ]
    },
    {
      "key": "reward",
      "fieldType": "gameVariable",
      "role": "sets",
      "gameId": "2377f69f-4c03-485a-8e08-de3bb6d7faf5",
      "setVariables": [
        { "variableId": "3b0c3e4e-5b1c-4a55-8f0a-5f7d1d2a9b11", "value": "5", "operation": "add" }
      ]
    }
  ]
}

templateId, template - optional. The template the document follows, such as Character or Location, and its name. Left out for a document without a template.

parentId - optional. The document this one sits under in the world's document tree. Left out for a top-level document.

fields - optional. The document's values, sorted by key. Only fields with Export switched on are listed (new fields have it on, apart from rich text), and only the fields the document has a value for. Left out when there are none.

Fields

Every entry has:

  • key - the field's export key, such as eye_color. It is set when the field is created and stays the same when the field is renamed.
  • fieldType - text, richText, number, boolean, choice, documentLink, documentList, image or gameVariable.

The value depends on the type:

fieldTypeValue
textvalue: the text.
richTextvalue: HTML. The built-in Content field (content) is listed once it has been written in LoreHub.
numbervalue: a whole number as a string, such as "34", like a Variable value.
booleanvalue: "true" or "false".
choicevalue: the picked option.
documentLinkvalue: the id of another document.
documentListdocumentIds: document ids in the order picked.
imagevalue: the id of the image in the world's gallery. framing is there when the picture isn't framed by default (centred, zoom 1, fit cover): x and y are the focus point in percent, zoom 1 to 4, fit cover or contain.
gameVariablerole and gameId, then a list that depends on the role (see below).

A referenced document is not always in the same export: a dialogue exported from Game Sync lists only the documents its dialogue mentions.

Game variable fields

A game variable field connects a document to the variables of one game (gameId). The variables are Variable resources of the same export when the dialogue belongs to that game.

  • "role": "tracks" - variableIds: the variables the document stands for, in order. A field can track several, such as gold and gold_coins.
  • "role": "requires" - requiredVariables: conditions that must all hold before the game resolves the document, written like an option's requiredVariables. operator is left out for ==.
  • "role": "sets" - setVariables: what the game writes when it resolves the document, written like a node's setVariableOnStart. operation is left out for set; add and subtract change a number.

Relations between documents (allies, parents, rivals) are not in the document resource: they are in relations.json, which uses the same document ids.