Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local xIni, yIni, zIni
- local xCur, yCur, zCur
- local fCur
- local posOut
- xIni, yIni, zIni = gps.locate(5)
- if not xIni or not yIni or not zIni then
- print("No or insufficient GPS hosts found")
- close()
- end
- while not turtle.forward() do
- while not turtle.up() do
- turtle.digUp()
- end
- end
- xCur, yCur, zCur = gps.locate(5)
- if zCur > zIni then
- fCur = 0
- elseif xCur < xIni then
- fCur = 1
- elseif zCur < zIni then
- fCur = 2
- elseif xCur > xIni then
- fCur = 3
- else
- exit()
- end
- while not turtle.back() do
- while not turtle.up() do
- turtle.digUp()
- end
- end
- xCur, yCur, zCur = gps.locate(5)
- posOut = io.open("data/pos.txt", "w")
- posOut:write(textutils.serialize({xCur, yCur, zCur, fCur}))
- posOut:close()
Advertisement
Add Comment
Please, Sign In to add comment