Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local xCord, yCord, zCord = gps.locate()
- local direction = ""
- term.clear()
- term.setCursorPos(1,1)
- print("CALIBRATE:")
- print("Pose a block at the NORTH of the EcTurtle.")
- print("Type something to start calibrate")
- read()
- function GoTo()
- print("Current position:")
- print(" x: " ..xCord)
- print(" y: " ..yCord)
- print(" z: " ..zCord)
- print("Go to position")
- print("x:")
- local x = read()
- print("y:")
- local y = read()
- print("z:")
- local z = read()
- if xCord < 0 then
- xC = 0 - xCord
- end
- if yCord < 10 then
- yC = 10
- end
- if zCord < 0 then
- xC = 0 - zCord
- end
- if tonumber(x) < 0 then
- direction = "west"
- turtle.turnLeft()
- for i=0,xC do
- if turtle.detect() == true then
- turtle.dig()
- turtle.forward()
- sleep(0.5)
- else
- turtle.forward()
- sleep(0.5)
- end
- end
- turtle.turnRight()
- else
- direction = "east"
- turtle.turnRight()
- for i3 = 0,xC do
- if turtle.detect() == true then
- turtle.dig()
- turtle.forward()
- sleep(0.5)
- else
- turtle.forward()
- sleep(0.5)
- end
- end
- turtle.turnLeft();
- end
- if tonumber(y) < yCord then
- direction = "down"
- for i1=0,yC do
- if turtle.detect() == true then
- turtle.digDown()
- turtle.down()
- sleep(0.5)
- else
- turtle.down()
- sleep(0.5)
- end
- end
- else
- direction = "up"
- for i2=0,yC do
- if turtle.detectUp() == true then
- turtle.digUp()
- turtle.up()
- sleep(0.5)
- else
- turtle.up()
- sleep(0.5)
- end
- end
- end
- if tonumber(z) < 0 then
- direction = "north"
- turtle.turnLeft()
- for i=0,zC do
- if turtle.detect() == true then
- turtle.dig()
- turtle.forward()
- sleep(0.5)
- else
- turtle.forward()
- sleep(0.5)
- end
- end
- else
- direction = "south"
- turtle.turnRight()
- sleep(0.5)
- turtle.turnRight()
- for i3 = 0,zC do
- if turtle.detect() == true then
- turtle.dig()
- turtle.forward()
- sleep(0.5)
- else
- turtle.forward()
- sleep(0.5)
- end
- end
- end
- turtle.turnLeft()
- sleep(0.5)
- turtle.turnLeft()
- end
- if turtle.detect() == false then
- turtle.turnRight()
- else
- print("CALIBRATED.")
- direction = "north"
- GoTo()
- end
- if turtle.detect() == false then
- turtle.turnRight()
- else
- print("CALIBRATED.")
- direction = "north"
- GoTo()
- end
- if turtle.detect() == false then
- turtle.turnRight()
- else
- print("CALIBRATED.")
- direction = "north"
- GoTo()
- end
- if turtle.detect() == false then
- print("NORTH NOT FOUND")
- print("restarting app...")
- else
- print("CALIBRATED.")
- direction = "north"
- GoTo()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement