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

{Help!}How to let turtle find its location and print it as x y and z?

Started by maydaylinus, 07 October 2012 - 08:04 AM
maydaylinus #1
Posted 07 October 2012 - 10:04 AM
Hello Pros-in-cc,
I have a extremely noob question to ask. I am trying to let a turtle find out its location and put it into variables x, y and z, sadly I can't.
I setup my gps tower already and the turtle can find their location with "gps locate"
Sorry but I am new to lua and cc, so I can'y figure out lots of staff. And my english is limited.
Please help!

rednet.open("left")
print("GPS calling for signal")
local x
local y
local z
x, y, z = gps.locate(5, true)
This is wrong, right….
Luanub #2
Posted 07 October 2012 - 10:25 AM
Do you have 4 or more computers running the gps program as hosts and they are in range of the turtle? that code should work. You can try to remove the debug arg and see if that helps.


rednet.open("left")
print("GPS calling for signal")
local x
local y
local z
x, y, z = gps.locate(5)
maydaylinus #3
Posted 07 October 2012 - 10:28 AM
Yes, I think my server got reset by my friend and now the gps host computers are not doing their duty, I will try.

It used to work.