Directionclass | travel.t[1447]

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`

Properties

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

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[1467]`

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

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

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

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

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

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

Class property: a LookupTable matching names to direction objects.

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

The direction that is opposite to this one.

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

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[1488]`

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[1474]`

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[1523]`

The dirProp that's the opposite to prop

Adv3Lite Library Reference Manual
Generated on 28/03/2016 from adv3Lite version 1.5