mouse03f

minetrip.lua

Mar 3rd, 2021 (edited)
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.36 KB | None | 0 0
  1. startx,starty,startz=gps.locate()
  2.  
  3. x,y,z = gps.locate()
  4. while(y > 12)
  5. do
  6.     turtle.digDown()
  7.     turtle.down()
  8.     x,y,z = gps.locate()
  9. end
  10.  
  11. mine = true
  12. while(mine)
  13. do
  14.     if mine == true
  15.     then
  16.         turn = math.random(1,3)
  17.         rnd = math.random(20,100)
  18.     end
  19.     while(rnd > 0)
  20.     do
  21.         turtle.dig()
  22.         turtle.forward()
  23.         turtle.digDown()
  24.         turtle.digUp()
  25.         rnd = rnd - 1
  26.        
  27.         slot = turtle.getItemCount(16)
  28.         if slot > 0
  29.         then
  30.             rnd = 0
  31.             mine = false
  32.             turn = 0
  33.         end
  34.         end
  35.     if turn == 1
  36.     then
  37.         turtle.turnRight()
  38.     elseif turn > 1
  39.     then
  40.         turtle.turnLeft()
  41.     end
  42. end
  43. endx,endy,endz = gps.locate(10)
  44. end1 = true
  45. while(end1)
  46. do
  47.     turtle.turnLeft()
  48.     turtle.dig()
  49.     turtle.forward()
  50.     x,y,z = gps.locate()
  51.    
  52.     disendx = startx - endx
  53.     if disendx < 0
  54.     then
  55.         disendx = disendx * -1
  56.     end
  57.    
  58.     discurx = startx - x
  59.     if discurx < 0
  60.     then
  61.         discurx = discurx * -1
  62.     end
  63.    
  64.     if disendx > discurx
  65.     then
  66.         end1 = false
  67.     end
  68.     turtle.back()
  69. end
  70.  
  71. end2 = true
  72. while(end2)
  73. do
  74.     turtle.dig()
  75.     turtle.forward()
  76.     x,y,z = gps.locate()
  77.  
  78.     discurx = startx - x
  79.     if discurx < 0
  80.     then
  81.         discurx = discurx * -1
  82.     end
  83.  
  84.     if discurx == 0
  85.     then
  86.         end2 = false
  87.     end
  88. end
  89.  
  90. end3 = true
  91. while(end3)
  92. do
  93.     turtle.turnLeft()
  94.     turtle.dig()
  95.     turtle.forward()
  96.     x,y,z = gps.locate()
  97.    
  98.     disendz = startz - endz
  99.     if disendz < 0
  100.     then
  101.         disendz = disendz * -1
  102.     end
  103.    
  104.     discurz = startz - z
  105.     if discurz < 0
  106.     then
  107.         discurz = discurz * -1
  108.     end
  109.    
  110.     if disendz > discurz
  111.     then
  112.         end3 = false
  113.     end
  114.     turtle.back()
  115. end
  116.  
  117. end4 = true
  118. while(end4)
  119. do
  120.     turtle.dig()
  121.     turtle.forward()
  122.     x,y,z = gps.locate()
  123.  
  124.     discurz = startz - z
  125.     if discurz < 0
  126.     then
  127.         discurz = discurz * -1
  128.     end
  129.  
  130.     if discurz == 0
  131.     then
  132.         end4 = false
  133.     end
  134. end
  135.  
  136. end5 = true
  137. while(end5)
  138. do
  139.     turtle.digUp()
  140.     turtle.up()
  141.     x,y,z = gps.locate()
  142.     if y == starty
  143.     then
  144.     end5 = false
  145.     turtle.turnLeft()
  146.     turtle.turnLeft()
  147.     turtle.turnLeft()
  148.     turtle.turnLeft()
  149.     end
  150. end
Add Comment
Please, Sign In to add comment