This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
gearpenguin's profile picture

Help With Retrieving Coordinates

Started by gearpenguin, 05 February 2017 - 04:17 AM
gearpenguin #1
Posted 05 February 2017 - 05:17 AM
Been working on a computercraft project recently and I need to be able to pull player coordinates and store them. I tried setting up a rednet connection to a pocket computer that would return its coordinates when prompted, but even when it locates it doesnt save the coordinates. Any idea on how I could store those values to variables in the pocket computer? I already know how to send them back.
Dog #2
Posted 05 February 2017 - 06:35 AM
You need to capture the values in variables, like so…

local x, y, z = gps.locate()

You can find more information here.
Edited on 05 February 2017 - 05:39 AM
gearpenguin #3
Posted 05 February 2017 - 02:15 PM
You need to capture the values in variables, like so…

local x, y, z = gps.locate()

You can find more information here.

I understand this. I set up a gps host, and the gps program worked, but when I did

local x, y, z = gps.locate()
And then try something like

print(x)
It just prints out a blank space with a one on the next line.

EDIT: just did a bit more reading and it appears that I need multiple computers running gps host
Edited on 05 February 2017 - 01:19 PM
Dog #4
Posted 05 February 2017 - 05:57 PM
Yes - you need at least 4 computers (2 each at different altitudes). If you want an 'easy' way to build a GPS cluster for your world you could try Lyqyd's Project Builder or GPS-Deploy. Please note the link to GPS-Deploy is shameless self-promotion (it links to the version I just released). If you'd prefer to use the original version of GPS-Deploy, go here.
Edited on 05 February 2017 - 05:16 PM