Glossary - ThePix/QuestJS GitHub Wiki

This is a work in progress, and undoubtedly the word you want is missing. Get in contact, if you have suggestions.

Array

An array (a list in Quest 5) is an ordered list. Each item in the array has a number, or index, and these run sequentially from 0. JavaScript allows you to easily add and remove elements from either end of an array.

An array can store anything; numbers, strings, functions, arrays, dictionaries. One array can be used for multiple types.

More on how they can be used here.

Array attributes of objects will only be saved if they are arrays of strings only or arrays of numbers only. Note that Quest will only check the first item; if it find a string there, it will assume this is a string dictionary and will throw an error if that is not the case.

Attribute

An attribute is some data or function that is associated with an object, and can be accessed via key. For example, all objects need a name, an attribute that is a string, accessed via the key "name".

This entry is an attribute of the glossary. It has data, the text you are reading, which is accessed through a key, the word "Attribute".

Attributes for items can be found here and for locations here.

Dictionary

A dictionary is a collection of values, where each value is accessed through a key; together they are an attribute. This document is a great example of a real-world dictionary - the values are all the definitions and the words are the keys. To find a value, say you want to know what a dictionary is, you use the key, i.e., the word "dictionary". The key is easy to find as they are listed alphabetically.

In computing a dictionary is a whole bunch of key-value pairs. And really, that is all an object is in both Quest 5 and Quest 6 (and indeed any interactive fiction system, I would guess).

In QuestJS, a dictionary can store anything; numbers, strings, functions, arrays, dictionaries. One dictionary can be used for multiple types, but note that dictionary attributes of objects will not be saved.

Technically, there are no dictionaries in JavaScript, they are actually objects, but you can treat them as dictionaries, and it is useful to distinguish them from objects in the sense of items and locations.

More on how they can be used here.

Disambiguation

Sometimes the user will type something that is ambiguous. Suppose she types GET BOO, is she trying to get the book or the boots? Disambiguation is the process of picking one or the other.

QuestJS will first look at which item is at the right location and has the appropriate attribute to make an educated guess, but if all else fails, it will ask the user to clarify, selecting from a list of options.

Disambiguation is the second biggest pain in the neck in parser software (after scoping).

Exit

An exit is an attribute that defines a link from one location to another. It is more convenient to consider the routes out of a location than the routes into the room - there is no corresponding entrance attribute.

Exit attributes are named for the direction, so an exit to the north will be the attribute named "north". The tutorial page gives a good introduction.

F12

You may come across mention of F12 in this documentation or if you get an error while playing a game. F12 is simply one of the function keys, and pressing it on most browsers will bring up the developer console, which is very useful for debugging.

That is not the case for Safari. You will need to first enable the "Developer Menu", by going to Safari Menu - Preferences and selecting the "Advanced Tab", then ticking "Show develop menu in menu bar". Then you can do Option-Command-C to open the console.

Free action

A free action is a command that relates to the game world, but the user can do it without time passing. For example, the LOOK command gives the user information about the game world, but is (presumably) just reminding the user about the text she has already seen; it is not having the player take a minute to survey the location.

LOOK, EXITS, INVENTORY, MAP and TOPICS are all free actions.

In QuestJS, authors can set settings.lookCountsAsTurn to true to make all free actions become normal commands.

See also Meta-command.

Interactive Fiction

From Wiki: Interactive fiction, often abbreviated IF, is software simulating environments in which players use text commands to control characters and influence the environment. Works in this form can be understood as literary narratives, either in the form of interactive narratives or interactive narrations. These works can also be understood as a form of video game, either in the form of an adventure game or role-playing game. In common usage, the term refers to text adventures, a type of adventure game where the entire interface can be "text-only", however, graphical text adventures still fall under the text adventure category if the main way to interact with the game is by typing text. Some users of the term distinguish between interactive fiction, known as "Puzzle-free", that focuses on narrative, and "text adventures" that focus on puzzles.

Item

An item is a type of object; an entity in the game world. Items are things the player can manipulate; everything that is not a location is considered an item in QuestJS. It is possibly for an object to be both, but this is not supported and probably a bad idea.

Key

In JavaScript, a key is a way to access data belonging to an object; it is the name of the attribute.

I recommend using whole words (i.e., using only letters, numbers and underscore) for keys so you can use the dot operator and omit the quotes, but spaces are allowed (you can also use numbers rather than strings).

List

What Quest 5 calls a list, JavaScript, and hence QuestJS, calls an array.

Location

A location is a type of object; an entity in the game world. Locations define the geography of the world, where the player is as she navigates around.

The term "room" is used interchangeably with "location". It has the advantage of being faster to type, but is less accurate as a room could be an outside location.

Meta-command

A meta-command is a command about the game system rather than the game world. Commands like HELP, ABOUT, SAVE, LOAD, DARK and SCORE are all meta-commands.

When a meta-command is executed, no time passes in the game world; by default the output will be in a different style. See also free action.

Normalisation

Normalisation is the process of taking something and converting into something else that fits what you expect. In statistics, a set of data is normalised if it is adjusted to give a mean of 100, for example.

QuestJS normalises the users input by breaking it up into individual commands, reducing it to lower case, replacing tabs with spaces and removing any extraneous spaces.

NPC

A non-player character, or NPC, is a character in your game world other than the player. Creating good NPCs is quite an art, but there is a starting point here.

Object

An object is an entity in the game world; either a location or an item or the game object. All objects belong to the dictionary "w".

Object (computing)

An object is a set of data, together with functions that operate, modify or access that data. Most modern programming languages are object-orientated, include JavaScript. However, QuestJS does not use objects in that way, so that is all that will be said on the subject!

Parser

The parser is the part of the software that tries to understand what the player typed. If all goes well, it will identify the right command, and, if appropriate, the items to apply it to.

Parser-based Game

Interactive fiction can be broadly divided between parser-based and choice-based. In a choice-based game, at each turn the user is presented with a limited set of options to choose from. In a parser-based game, the user is presented with a text field where a command can be typed and a parser will attempt to understand it.

There are variants, cross-overs and alternatives to these two approaches, but as far as I know, all interactive fiction systems target one or the other - Quest in all its versions targets parser-based games.

Player

The player can refer to the person playing the game or to the persona in the game world that is being controlled. The latter is a specific item.

These help files are moving towards using "user" for the person sat at the computer playing the game, in the hope that this will be less confusing, but it may not always be so.

The player can also mean the software used for playing a game, rather than editing a game, though this is not applicable to Quest JS.

Quest

Quest is a system for writing and playing interactive fiction, originally written by Alex Warren, and first released in 1998. Quest 5 was released in 2011. A timeline for Quest 1 to 5 can be found here.

QuestJS or Quest 6 is the latest version.

Regular Expression (Regex)

A regular expression, or regex for short, is a pattern that can be matched against a string. It allows for various types of wildcards, quantifiers, groups and anchors, allowing for the construction of very complex patterns. They are an important part of the parser as commands are found by matching against regexes, but a superficial knowledge of them will suffice for QuestJS.

More here.

Room

See location.

RPG

In a role-playing game, or RPG, the user is generally given the opportunity to customise the player to some degree, and that customisation will then impact how successfully the player can perform tasks in the game, most notably in combat. There will often be opportunities to further upgrade the player as the game continues.

This is not restricted to interactive fiction. Dungeons & Dragons is probably the most well-known example, but computer games like Skyrim and Mass Effect are other examples.

RPGs are complex, but there is a good basis to be found here.

Template

A template is a set of default attributes for a certain type of item. Add a template to an item when creating it to quickly give it some pre-defined behavior. More here.

Text processor

The text processor is a part of Quest that converts a string from one thing to another, depending on codes embedded in the original string. Codes are surrounded by curly braces, and consist of a directive followed by parameters, all separated by colons. The example below cause the text "red balloon" to appear in red.

You can see a {colour:red:red balloon} floating through the sky.

The text processor can be used for all sorts of things; for example, it in used in the responses to most commands to allow Quest to give responses that are natural English, adapting to whether an item is singular or plural.

See more here.

this

The variable this is special; it refers to the object to which the function is attached.

Note that if you have an object with a dictionary attribute, and a function inside the dictionary, this will refer to the dictionary, not the object.

UI

The user interface, or UI, is the bit of your game between the game and the real world - that is to say, what appears on the screen and how the player interacts with it.

As QuestJS runs in a browser, and is entirely written in JavaScript, there is a huge amount you can do. If you have every seen it on a web site, you can do it in QuestJS - but not necessarily easily...

It is a huge topic, and there are a lot of pages on your various options. Here is the introduction.

use strict

This is a special directive at the start of each Quest JS file, and it tells the browser to use strict mode when running JavaScript. Strict mode disallows certain things, which means it will catch certain bugs immediately. It is also more secure and potentially faster.

More here.

w

In JavaScript the global world includes every built-in function, elements of the web page, etc. It is therefore necessary to have a sealed off section that is the game world. This is called w. To access an object called "table", you have to go via w, so must use w.table or w["table"] to get it.

Only objects in w get saved when the player saves a game.