Directionclass

travel.t[1678]

Superclass
Tree

Subclass
Tree

Global
Objects

Property
Summary

Method
Summary

Property
Details

Method
Details

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[1748]

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[1698]

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

dirProp

travel.t[1684]

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

name

travel.t[1690]

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

nameTab

travel.t[1693]

Class property: a LookupTable matching names to direction objects.

opposite

travel.t[1751]

The direction that is opposite to this one.

sortingOrder

travel.t[1741]

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[1719]

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[1705]

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[1754]

The dirProp that’s the opposite to prop

propDir (prop)

travel.t[1763]

The direction to which prop points.

Adv3Lite Library Reference Manual
Generated on 15/03/2023 from adv3Lite version 1.6.1