Skip to content

Core.aslx functions

Functions with very specific effects in the game world.

AddDescriptionLine (string description so far, string line)

Returns a string. Building-block used to assemble a multi-line description: if line is non-empty, any text already accumulated in description so far is printed immediately (via msg) and the description is reset to just line; if line is empty, description so far is returned unchanged. This lets you print each non-blank line as its own paragraph while collapsing blank lines, by repeatedly calling it and printing whatever’s left over at the end.

AddToInventory (object)

Moves the object to the inventory. This simply sets the object’s parent to the current player, so:

AddToInventory(myobject)

is equivalent to

myobject.parent = game.pov
CanReachThrough (object)

Returns a boolean - true if the player can reach through the object.

CanSeeThrough (object)

Returns a boolean - true if the player can see through the object.

ChangePOV (object)

Switches the current player object (point of view) to the given object, which must already have a parent (e.g. be placed somewhere in the game world). Triggers OnEnterRoom for the new POV’s location. See Changing the player object for a full walkthrough.

CheckDarkness()

Returns a boolean - true if the player is in a room which is dark and has no strong lightsources in it. It also records the answer in the room’s darklevel attribute as it goes.

See also SetDark, SetLight, SetObjectLightstrength, SetExitLightstrength

CloneObjectAndInitialise (object)

Returns an object. Clones the object using CloneObject and, if the clone has an _initialise_ script, runs it. Useful for prototype objects that need to set up their own state (e.g. random stats) each time a new copy is created, rather than only when moved into a room - see also CloneObjectAndMoveHere.

FinishTurn ()

Ends the current turn: runs turn scripts (if game.runturnscripts is set and they haven’t been suppressed), then updates status attributes and darkness/hyperlink state for the next command. Quest Viva calls this automatically after each player command; you would only call it yourself if you’re driving a “turn” from custom code that bypasses the normal command loop.

FormatContentsList (string pre-list, object parent, string pre-final, string post-list, boolean include scenery)

Returns a string containing a formatted list of the direct children of parent. This is the shared implementation behind FormatObjectList (include scenery false) and FormatInventoryList (include scenery true) - call one of those instead unless you specifically need a third scenery-filtering behaviour.

FormatExitList (string pre-list, objectlist exits, string pre-final, string post-list)

Returns a string containing a formatted list of exits.

For example, this:

FormatExitList("You can go", ScopeExits(), "or", ", if you like.")

may return output like this:

You can go east, west or south, if you like.

FormatInventoryList (string pre-list, object parent, string pre-final, string post-list)

Returns a string containing a formatted list of what parent is carrying, for the “inventory” command. Unlike FormatObjectList, scenery-flagged objects are always included: “scenery” means “don’t clutter the room description with this”, not “don’t tell the player they’re holding it”.

FormatObjectList (string pre-list, object parent, string pre-final, string post-list)

Returns a string containing a formatted list of objects.

Used by ShowRoomDescription to list what is in the room, and by the “look at” handling to list what is inside a container. The “inventory” command uses FormatInventoryList instead, because it needs scenery included.

FormatObjectList will display children of listed objects within brackets, if the parent object can be seen through.

For example, this:

FormatObjectList("You can see", player.parent, "and", "in this room.")

may return output like this:

You can see a sofa, a lamp, a box (containing a diary and a pen) and a kitten in this room.

All object names will be hyperlinked to show a menu of verbs - displayverbs for objects in the room, or inventoryverbs for anything the player is carrying, chosen automatically by GetDisplayVerbs.

GetBlockingObject (object)

Returns the object which is preventing the player from reaching the specified object.

If an object is in ScopeVisible but not in ScopeReachable, then it may be inside a container where the player can see it but not reach it. You can call the GetBlockingObject function to find out what is “blocking” the player from reaching the object. It will be the top-most parent which the player cannot reach through.

GetClone (object prototype, object parent)

Returns the object among parent’s direct children whose prototype attribute points to prototype, or null if there isn’t one. parent is optional and defaults to the current player. Useful for finding a previously-made clone (see CloneObject) instead of creating a new one.

GetDefiniteName (object)

Returns a string containing the full displayed name of an object, prefixed with “the” if it is neither a named male or a named female.

GetDisplayAlias (object)

Returns a string containing the displayed version of the object name. This will be the alias, if the object has one, otherwise it will just be the object name.

GetDisplayName (object)

Returns a string containing the full displayed name of an object.

This will be the prefix + the result from GetDisplayAlias + the suffix.

For Quest 5.3 and earlier:

GetDisplayNameLink (object, string type, stringlist verbs)

For Quest 5.4 and later, there is no verbs parameter:

GetDisplayNameLink (object, string type)

Returns a string containing the full displayed name of an object.

This will be the prefix + the result from GetDisplayAlias + the suffix.

If type is not an empty string (and, in Quest 5.3 and earlier, a verbs list is specified), the result will include the display alias wrapped in an <object> tag complete with verbs. This will mean the Quest Viva interface will display a hyperlinked object name with a menu of verbs. In Quest 5.4 and later, the displayverbs or inventoryverbs are picked up automatically depending on the object’s parent.

GetDisplayVerbs (object)

Returns a stringlist with the current display verbs for the object. If the object is in the current player’s inventory, the inventoryverbs are used as a base, otherwise the displayverbs are used. If autodisplayverbs is turned on, any verbs set up for the object will be added to the list returned.

GetListDisplayAlias (object)

Returns a string containing the displayed version of the object name to use in the object panes. This will be the listalias, if the object has one, otherwise it will be the result of GetDisplayAlias.

GetNonTransparentParent (object)

Returns the first object in the parent hierarchy that is non-transparent. If the object specified in the parameter is the player, then it is the limit of what the player can see out of - usually the object that represents the current room.

So if the player gets onto a platform within a room, or is inside a transparent box within the room, you can still find out the overall parent room by calling this function.

GetRoomDescription ()

Returns a string containing the full formatted description of the current room (the current player’s parent) - the same text ShowRoomDescription would print, including the dark-room fallback from CheckDarkness. Useful if you want the description as text rather than having it printed immediately, e.g. to include it in a menu or a saved log.

GetVolume (object, boolean inclusiveobject)

Returns the volume of an object with all its children.

If inclusiveobject is false, then the volume of all objects within object is returned without the volume of object itself.

If inclusiveobject is true, then the volume of all objects within object is returned inclusive the volume of object itself.

Got (object)

Returns a boolean - true if the player has the specified object. This is just a convenient shortcut to seeing if it is within the list returned by ScopeInventory.

GridSquareClick (integer x, integer y)

Override hook for grid maps: the default implementation does nothing. Copy this function into your game and give it a body to handle clicks on a grid map square, using the clicked square’s coordinates.

HelperCloseObject (object)

Closes the object. This simply sets the isopen attribute to false.

See also HelperOpenObject

HelperOpenObject (object)

Opens the object. This simply sets the isopen attribute to true.

See also HelperCloseObject

IsSwitchedOn (object)

Returns a boolean - true if the object is switched on.

This function simply reads the switchedon attribute of the object.

ListParents (object)

Returns an objectlist of all parents of an object - the object’s direct parent, the parent’s parent, and so on.

MoveObjectHere (object)

Moves the object to the current player’s room. Equivalent to object.parent = game.pov.parent. See also MoveObject to move an object to an arbitrary parent, and AddToInventory to move it into the player’s inventory instead.

SetDark(room)

Set a room to dark. Objects and Exits can’t be seen unless there is a lightsource object in this room.

See also SetLight, SetObjectLightstrength,SetExitLightstrength, CheckDarkness

SetExitLightstrength(exit, string value)

Define an exit as a lightsource. A possible value is:

“” (empty string) : exit is not a lightsource and is not visible in a dark room

“weak” : exit is visible in a dark room

“strong” : exit enlightens a dark room, so the normal room description is shown

See also SetDark, SetLight, SetObjectLightstrength, CheckDarkness

SetLight(room)

Set a room to light.

See also SetDark, SetObjectLightstrength, SetExitLightstrength, CheckDarkness

SetObjectLightstrength(object, string value)

Define an object as a lightsource. A possible value is:

“” (empty string) : object is not a lightsource and is not visible in a dark room

“weak” : object is visible in a dark room

“strong” : object enlightens a dark room, so the normal room description is shown

See also SetDark, SetLight, SetExitLightstrength, CheckDarkness

Internal function to Core.aslx - games should not normally need to call internal functions.

ShowRoomDescription ()

Does not return a value.

SwitchOff (object)

Switches off the specified object, simply by setting the switchedon property to false.

SwitchOn (object)

Switches on the specified object, simply by setting the switchedon property to true.

WhereAmI (string platform name)

Sets the questplatform attribute on game to the given string. Despite the name, this has nothing to do with the player’s location - nothing in the current engine reads questplatform back, so this is a legacy hook rather than something new games need to call.