Skip to content

File structure

ThePix edited this page Jul 16, 2019 · 3 revisions

There are three distinct file formats for editor uses:

Name Extension Access
Quest 5 XML .aslx read only
Quest 6 XML .asl6 read and write
JavaScript .js write only

Quest 5 XML and Quest 6 XML are broadly similar. The major differences are:

  • Quest 5 XML has "inherit" elements to indicate the type of an object, whilst Quest 6 XML has various internal attributes, all starting "js" for that (note that it an "inherit" element is not recognised this gets flagged).
  • Quest 5 XML nests objects inside each other to indicate the ownership hierarchy, Quest 6 XML is flat, using "loc" to indicate ownership.
  • Quest 6 supports the attribute types "js" for JavaScript code, and "blockly" for Blockly XML. On the other hand it currently des not support double, dictionaries or lists other than string lists.

When loading a Quest 5 XML file, any issues get logged in an array attribute of the object, jsConversionNotes, which can (potentially) be displayed, so the player can see any issues.

Internal representation

The internal representation is a flat array, despite being displayed as a hierarchy, and closely mimics Quest 6 XML. Each object is a JavaScript object.

Code is stored in dictionaries, with a "lang" attribute to note the language and "code" for the content. This allows it to store JavaScript, ASL and Blockly.

Various attributes are used internally to handle templates (which are used and the values sent to them). Two are strings, handling mutually exclusive states:

jsMobilityType = Takeable/Player/NPC/Topic/Immobile
jsContainerType = Surface/Container/Openable/Vessel/No

Most are Boolean.

jsIsRoom
jsIsLockable
jsIsWearable
jsIsCountable
jsIsFurniture
jsIsSwitchable
jsIsComponent

There are a number of attributes that are used only by the editor to determine how an item is displayed in the hierarchy n the left:

jsExpanded
jsIsZone
jsColour

There is also a jsComments attribute for each object.

THese should all be saved in the Quest 6 XML file, but not the JavaScript file.

JavaScript file

The JavaScript format is the data.js file used by QuestJS.

When outputting to JavaScript, the templates are determined from internal attributes.

To see how this works, consider a container in a Quest 5 game. This inherits the "container_closed" type. When QEdit loads the file, it sets:

object.jsContainerType = "Container";
object.jsContainerClosed = true;

These two attributes are now part of the object, so will get saved as such in Quest 6 XML, and read back again when loaded. However, when the JavaScript file is created, these are used to create the code for the right template.

Clone this wiki locally