Gps (API)

From ComputerCraft Wiki
Revision as of 04:39, 7 July 2012 by 71.236.171.177 (Talk) (Undo revision 1972 by 91.121.27.33 (talk) Removing spam)

Jump to: navigation, search

The gps API provides a method for turtles and computers to retrieve their own locations.

It broadcasts a PING message over rednet and wait for responses. In order for this system to work, there must be at least 4 computers used as gps hosts which will respond and allow trilateration. You can set up hosts using the gps program.

Methods

Method name Description
gps.locate(timeout, debug) Tries to retrieve the computer or turtle own location.

@param timeout the amount of time, in seconds, to wait for a rednet response
@param debug if true, outputs debug messages
@return the computer or turtle own location (x, y, z) or nil if it could not be determined