gps

Use modems to locate the position of the current turtle or computers.

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. Three of these hosts should be in a plane, and the fourth should be either above or below the other three. The three in a plane should not be in a line with each other. You can set up hosts using the gps program.

note

When entering in the coordinates for the host you need to put in the x, y, and z coordinates of the block that the modem is connected to, not the modem. All modem distances are measured from the block that the modem is placed on.

Also note that you may choose which axes x, y, or z refers to - so long as your systems have the same definition as any GPS servers that're in range, it works just the same. For example, you might build a GPS cluster according to this tutorial, using z to account for height, or you might use y to account for height in the way that Minecraft's debug screen displays.

See also

Changes

CHANNEL_GPS = 65534The channel which GPS requests and responses are broadcast on.
locate([timeout=2 [, debug=false]])Tries to retrieve the computer or turtles own location.
CHANNEL_GPS = 65534Source

The channel which GPS requests and responses are broadcast on.

locate([timeout=2 [, debug=false]])Source

Tries to retrieve the computer or turtles own location.

Parameters

  1. timeout? number = 2 The maximum time in seconds taken to establish our position.
  2. debug? boolean = false Print debugging messages

Returns

  1. number This computer's x position.
  2. number This computer's y position.
  3. number This computer's z position.

Or

  1. nil If the position could not be established.