Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("Returning...")
- hX = -723
- hY = 4
- hZ = -198
- trackingX = true
- trackingZ = true
- trackingY = false
- pathing = true
- fuelSlot = 1
- compareSlot = 2
- turtle.select(fuelSlot)
- turtle.refuel()
- -- X-Coord
- while trackingX do
- x, y, z = gps.locate(10)
- turtle.forward()
- oX, oY, oZ = gps.locate(10)
- if not (math.abs(hX - oX) < math.abs(hX - x)) then
- turtle.back()
- turtle.turnLeft()
- if math.abs(hX - oX) == 0 then
- trackingX = false
- print("Located X value.")
- end
- end
- end
- -- Z-Coord
- while trackingZ do
- x, y, z = gps.locate(10)
- turtle.forward()
- oX, oY, oZ = gps.locate(10)
- if not (math.abs(hZ - oZ) < math.abs(hZ - z)) then
- turtle.back()
- turtle.turnLeft()
- if math.abs(hZ - oZ) == 0 then
- trackingZ = false
- print("Located Z value.")
- end
- end
- end
- -- Y-Coord -- WIP
- while trackingY do
- x, y, z = gps.locate(10)
- turtle.up()
- oX, oY, oZ = gps.locate(10)
- if not (math.abs(hY - oY) < math.abs(hY - y)) then
- turtle.down()
- if math.abs(hY - oY) == 0 then
- trackingY = false
- print("Located Y value.")
- end
- end
- end
- -- Pathing
- print("Running pathing program...")
- turtle.select(2)
- if (turtle.compareDown) then
- rotations = 0
- while pathing do
- turtle.forward()
- if (turtle.compareDown() == false) then
- turtle.back()
- if (rotations == 0) then
- turtle.turnLeft()
- elseif (rotations == 1) then
- turtle.turnRight()
- turtle.turnRight()
- elseif (rotations == 2) then
- turtle.turnLeft()
- print("Path ended.")
- pathing = false
- break
- end
- rotations = rotations + 1
- else
- rotations = 0
- end
- end
- else
- print("No path.")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement