Advertisement
Guest User

togo

a guest
Apr 27th, 2015
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.96 KB | None | 0 0
  1. BlockCounter = 0
  2. InvCounter = 0
  3. once = true
  4. xTotal = g_x - gps_x
  5. zTotal = g_z - gps_z
  6. yTotal = g_y - gps_y
  7. g_x = -7
  8. g_z = 1
  9. g_y = 72
  10.          --^put go cords^--
  11. h_x = -3
  12. h_z = 1
  13. h_y = 76
  14.                 --^Home cords^--
  15. ----user friendly-----
  16.     ---make it--
  17. -----------------------
  18.  
  19. while true do
  20.     gps.location = gps.locate()
  21.     gps_x = gps_location[0]
  22.     gps_z = gps_location[1]
  23.     gps_y = gps_location[2]
  24.     --Y direction--
  25.     if gps_y > g_y - 1 or gps_y < g_y - 1 then
  26.         --Digging down--
  27.         if g_y < 0 then
  28.             turtle.digDown()
  29.             turtle.down()
  30.             turtle.placeUp()
  31.         --Digging up--
  32.         else
  33.             turtle.digUp()
  34.             turtle.up()
  35.             turtle.placeDown()
  36.         end
  37.     --X direction--
  38.     elseif gps_x > g_x or gps_x < g_x then
  39.         if g_x - gps_x > xTotal then
  40.             turtle.turnRight()
  41.             turtlr.turnRight()
  42.         end
  43.         turtle.dig()
  44.         turtle.forward()
  45.         InvCounter = turtle.getItemCount(1)
  46.         if InvCounter > 0 then
  47.             BlockCounter = BlockCounter + 1
  48.         end
  49.         if BlockCounter == 1 then
  50.             turtle.dig()
  51.             turtle.forward()
  52.             turtle.turnRight()
  53.             turtle.turnRight()
  54.             turtle.place()
  55.             turtl.turnRight()
  56.             Turtl.turnRight()
  57.         else
  58.             turtle.turnRight()
  59.             turtle.turnRight()
  60.             turtle.place()
  61.             turtle.turnRight()
  62.             turtle.turnRight()
  63.         end
  64.         --Z direction--
  65.     else
  66.   if gps_z > g_z or gps_z < g_z then
  67.         if once == true then
  68.             if g_z < 0 then
  69.                 turtle.turnRight()
  70.             else
  71.                 turtle.turnLeft()
  72.             end
  73.             once = false
  74.         end
  75.         if g_z - gps_z > zTotal then
  76.             turtle.turnRight()
  77.             turtlr.turnRight()
  78.         end
  79.         turtle.dig()
  80.         turtle.forward()
  81.         InvCounter = turtle.getItemCount(1)
  82.         if InvCounter > 0 then
  83.             BlockCounter = BlockCounter + 1
  84.         end
  85.         if BlockCounter == 1 then
  86.             turtle.dig()
  87.             turtle.forward()
  88.             turtle.turnRight()
  89.             turtle.turnRight()
  90.             turtle.place()
  91.             turtl.turnRight()
  92.             Turtl.turnRight()
  93.         else
  94.             turtle.turnRight()
  95.             turtle.turnRight()
  96.             turtle.place()
  97.             turtle.turnRight()
  98.             turtle.turnRight()
  99.         end
  100.     end
  101. end
  102.  
  103.  
  104. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement