Built-in String Variables

Quest has several built-in strings which can be accessed in the same way as normal strings. These strings are listed below. Note that in QuestNet Server you also need to specify an array index - see the note at the bottom of the page for details.

quest.command

Returns the command that the player typed in, after synonyms have been processed. Use quest.originalcommand to access the original form of the command. For example, if "read" is specified as a synonym of "examine", and quest.originalcommand contains "read the book", then quest.command will contain "examine the book".

quest.currentroom

Returns a string containing the "real" name (i.e. proper code name) of the current room. quest.formatroom returns the displayed version of the room name.

quest.doorways.dirs

Returns a list of directions that can be used, eg. "north, west".

quest.doorways.places

Returns a list of places that the player can access by typing "go to ..."

quest.doorways.out

Returns the real name of the place that the player will exit to if he/she types "out"; otherwise is empty.

quest.doorways.out.display

Returns the displayed name of the place that the player will exit to if he/she types "out"; otherwise is empty.

quest.formatobjects

Returns a text-formatted list of objects in the current room.

quest.formatroom

Similar to quest.currentroom, but returns the displayed name of the room - so if an alias has been used, this will return the alias, and if a prefix has been used, a prefix is included.

quest.lastobject

Returns the (real) name of the last object that the player referred to in a command.

quest.lookdesc

Returns the current room's description as specified by its look tag.

quest.objects

Returns a list of objects in the current room.

quest.originalcommand

Returns the command the user just typed (converted to lower case). quest.command returns the command after processing for synonyms.

 

For example:

if ( #quest.currentroom# = library) then msg <You are in the library>

will print "You are in the library", if you’re in the library.

The string variables above are especially useful when customising room descriptions - they give access to information such as the doorways present, things in the room, etc. which can be printed on the screen. See How to Customise Room Descriptions for more information.

QuestNet Server: An array index with the user ID needs to be specified for all the built-in string commands listed here. So, to return the command the player in the current scope last typed in, use #quest.command[userid]#.

 

< Back