Direction class | travel.t[1915]

A Direction object represents a direction in which an actor might attempt to travel. The library defines eight compass directions (north, south, etc.) and a further eight special directions (in, out, up, down, port, starboard, fore and aft), but game code can define additional directions if required.

The convention that should be followed in naming a Direction object is to use the name of the direction followed by Dir; e.g. the Direction object corresponding to north is called northDir. Custom directions should follow the same convention, since it is assumed by the goInstead() and goNested() macros.

`class Direction : object`

Superclass Tree (in declaration order)

`Direction`
`object`

Subclass Tree

`Direction`
`CompassDirection`
`ShipboardDirection`

Global Objects

`downDir inDir outDir upDir`

Summary of Properties

`allDirections departureName dirProp name nameTab opposite sortingOrder`

Summary of Methods

`classInit initializeDirection oppositeProp propDir`

Properties

`allDirections` | `travel.t[1985]`

A Class property containing a Vector of all the directions defined in the game (the 16 defined in the library plus any additionasl custom directions defined in game code)

`departureName` | `travel.t[1935]`

The name to use when departing via this direction, e.g. 'to the north'

`dirProp` | `travel.t[1921]`

The exit property of a room association with this Direction, e.g. &north (corresponding to northDir).

`name` | `travel.t[1927]`

The name of this direction, e.g. 'north'. This is the name that appears in the exit lister.

`nameTab` | `travel.t[1930]`

Class property: a LookupTable matching names to direction objects.

`opposite` | `travel.t[1988]`

The direction that is opposite to this one.

`sortingOrder` | `travel.t[1978]`

Our sorting order in the master list. We use this to present directions in a consistent, aesthetically pleasing order in listings involving multiple directions. The sorting order is simply an integer that gives the relative position in the list; the list of directions is sorted from lowest sorting order to highest. Sorting order numbers don't have to be contiguous, since we simply put the directions in an order that makes the sortingOrder values ascend through the list.

Methods

`classInit ( )` | `travel.t[1956]`

Class initialization - this is called once on the class object. We'll build our master list of all of the Direction objects in the game, and then sort the list using the sorting order.

`initializeDirection ( )` | `travel.t[1942]`

Initialize. We'll use this routine to add each Direction instance to the master direction list (Direction.allDirections) during pre-initialization.

`oppositeProp (prop)` | `travel.t[1991]`

The dirProp that's the opposite to prop

`propDir (prop)` | `travel.t[2000]`

The direction to which prop points.

Adv3Lite Library Reference Manual
Generated on 25/04/2024 from adv3Lite version 2.0