Distance

From Wherigo Foundation Wiki
Jump to: navigation, search

Distance represents a distance. It apparently has a numeric value and units. This is one of the classes which reverse engineering does not fully expose.

Distances could be added, subtracted and multiplied. They could also divided by a number, but not by a distance. Distances could be converted to a string (only in meters) and could be compared.


Properties

value Number The distance in meters. Note that the author probably intends us to use the GetValue() method rather than accessing this property directly.


Methods

Clone Returns Distance Creates a copy of the distance object.
GetValue Returns Number Takes a single string argument which determines the units in which distance is returned. Known permissible values are 'ft', 'feet', 'm', 'meter', 'metres', 'kilometers', 'kilometres', 'km', 'miles', 'mi', 'nauticalmiles' and 'nm'. Also note that GetValue is the default method. If d is a variable of type Distance, d("ft") returns the same value as d.GetValue("ft") and d(1,"ft") is the same as d.SetValue(1,"ft"). If no unit is given, 'meters' are used.


Constructor

Wherigo.Distance(value, units)

value Number The distance, in the units specified by the following parameter.
units String The units the value of the previous parameter should be measured in. Values supported by Builder include "feet", "miles", "meters", "kilometers", and "nauticalmiles". If there is no unit provided, "meters" are assumed.