Quest (Language)

From IFWiki
Jump to: navigation, search

Quest 5 is an authoring system designed for non-programmers and programmers alike. It features a GUI interface that makes adding rooms and objects as easy as a few mouse clicks, but allows the use to swap into code mode at the click of a button to edit the under-lying XML code directly.

Quest 5 supercedes, and is quite different to, Quest 4

How Does It Look?

QuestExample.png

A very short game seen in the GUI above, and the XML code for it below:

 <asl version="520">
   <include ref="English.aslx" />
   <include ref="Core.aslx" />
   <game name="example">
     <gameid>ed69c767-628f-4438-bc60-0ac11c8e54e4</gameid>
     <version>1.0</version>
   </game>
   <object name="room">
     <inherit name="editor_room" />
     <object name="player">
       <inherit name="defaultplayer" />
     </object>
     <object name="cup">
       <inherit name="editor_object" />
       <alias>Red Cup</alias>
     </object>
   </object>
 </asl>

Quest games can also be created and edited on-line.

How Is It Played?

The Quest editor includes a Publish tool, which converts from the .aslx file to a .quest file. The .quest file can be distributed for playing directly in the Quest editor (but cannot be edited in that format), or can be uploaded to the Quest web runner, for on-line play.

The Quest Website is a general repository for Quest adventures, and includes facilities for players to review and comment on games. However, as Quest is open source it is perfectly possible to set up your own web runner on your own server.

Components

The basic unit of a Quest game is an XML element, which could be an object, room, exit or other entity. XML elements have attributes that identify them and allow them to interactive with each other. For example, objects and exits will have a parent attribute, signifying its current locationn, rooms and objects have name attributes to identify them.

Quest has much functionality built-in, but this can be extended and overridden. Functions are standalone elements, scripts are attached to other elements. Quest supports types, and again these can be defined by the user. Types allow objects of a similar nature to be give the same properties (such as the container type). One type can inherit from another, so a lockedcontainer type inherits from a container type. Users can create new commands, or override old commands to do new things, while the related verbs are assocaiated with specific objects (or types of objects).

Any of these elements can be included in library files, which can also include instructs to update the editor GUI, allowing new attributes to be readily accessible.

A Full Scripting Language

Below is an example of a type defined, "attackspell", which inherits from another type. The spelleffect attribute is a script, illustrating the somewhat C-like scripting language (though it uses = for equality testing, rather than ==).

 <type name="attackspell">
   <inherit name="spell"/>
   <spelleffect type="script"><![CDATA[
     // Iterate through all objects in the room
     // Apply attack to those with the monster type that are not dead
     type = GetTarget (this)
     flag = False
     foreach (obj, ScopeVisibleNotHeld ()) {
       if (DoesInherit (obj, type) and not GetBoolean (obj, "dead")) {
         player.spelltarget = obj
         do (this, "spelltargeteffect")
         flag = True
       }
     }
     if (not flag) {
       Print (this.nothingaffected)
     }
   ]]></spelleffect>
 </type>

Here is a function defined to remove any instance of the character c from the string s.

 <function name="LTrimAny" parameters="s, c" type="string">
   if (not LengthOf(c) = 1) { error ("Second parameter must be a single character in LTrimAny") }
   while (StartsWith(s, c)) {
     s = RemoveLeft(s)
   }
   return (s)
 </function>

Language Support

Quest 5 has multi-lingual support built-in, through the use of templates. The appropriate language library file is required at the head of the file (as English.aslx is in the example given earlier). As of October 2012, Quest 5 has library files to support German, Spanish, Esperanto, French and Dutch.

Documentation

There is a Quest 5 Wiki that documents the system, and has a tutorial and several "How to" guides.

Links