Advertisement
Guest User

Test

a guest
Mar 30th, 2020
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.29 KB | None | 0 0
  1. function clearConsole()
  2.         term.clear()
  3.         term.setCursorPos(1,1)
  4. end
  5.  
  6. function turtleUp()
  7.         while turtle.up() == false  do
  8.                 turtle.digUp()
  9.                 turtle.attackUp()
  10.         end
  11. end
  12.  
  13. function turtleDown()
  14.         while turtle.down() == false do
  15.                 turtle.digDown()
  16.                 turtle.attackDown()
  17.         end
  18. end
  19.  
  20. function turtleRight()
  21.         turtle.turnRight()
  22.         while turtle.forward() == false do
  23.                 turtle.dig()
  24.                 turtle.attack()
  25.         end
  26. end
  27.  
  28. function turtleLeft()
  29.         turtle.turnLeft()
  30.         while turtle.forward() == false do
  31.                 turtle.dig()
  32.                 turtle.attack()
  33.         end
  34. end
  35.  
  36. function turtleFore()
  37.         while turtle.forward() == false do
  38.                 turtle.dig()
  39.                 turtle.attack()
  40.         end
  41. end
  42.  
  43. function turtleBack()
  44.         if turtle.back() == false then
  45.                 turtle.turnRight(2)
  46.                 while turtle.forward() == false do
  47.                         turtle.dig()
  48.                         turtle.attack()
  49.                 end
  50.                 turtle.turnRight()
  51.                 turtle.turnRight()
  52.         else
  53.         end
  54. end
  55.  
  56. function compareDown()
  57.         turtle.select(1)
  58.         if turtle.compareDown() == false then
  59.                 turtle.select(2)
  60.                 while turtle.placeDown() == false do
  61.                         turtle.digDown()
  62.                         turtle.attackDown()
  63.                 end
  64.         else
  65.         end
  66. end    
  67.  
  68.  
  69. clearConsole()
  70. write('How far forward? ')
  71. x = read()
  72. j = 0
  73. clearConsole()
  74. print('Mining in progress...')
  75. print()
  76. print()
  77. print('<                         >')
  78. term.setCursorPos(13,5)
  79. print('0%')
  80.  
  81. for i=1,x-1 do
  82.         if j%11 == 0 then
  83.                 turtle.turnRight()
  84.                 turtle.turnRight()
  85.                 turtle.select(16)
  86.                 turtle.place()
  87.                 turtle.select(1)
  88.                 turtle.turnRight()
  89.                 turtle.turnRight()
  90.         elseif (j-5)%11 == 0 then
  91.                 turtle.turnRight()
  92.                 turtle.turnRight()
  93.                 turtle.select(16)
  94.                 turtle.place()
  95.                 turtle.select(1)
  96.                 turtle.turnRight()
  97.                 turtle.turnRight()
  98.         end
  99.         j = j+1
  100.         turtleFore()
  101.         compareDown()
  102.         turtleUp()
  103.         turtleUp()
  104.         turtleLeft()
  105.         turtle.turnRight()
  106.         turtleDown()
  107.         turtle.turnLeft()
  108.         turtleDown()
  109.         compareDown()
  110.         turtle.turnRight()
  111.         turtle.turnRight()
  112.         turtleFore()
  113.         turtleFore()
  114.         compareDown()
  115.         turtle.turnLeft()
  116.         turtleUp()
  117.         turtle.turnRight()
  118.         turtleUp()
  119.         turtle.turnLeft()
  120.         turtle.turnLeft()
  121.         turtleFore()
  122.         turtle.turnRight()
  123.         turtleDown()
  124.         turtleDown()
  125.        
  126.         p = (i/x-(i/x)%0.0001)*100
  127.         term.setCursorPos(13,5)
  128.         n = tostring(p)
  129.         term.clearLine()
  130.         print(n .. '%')
  131.         term.setCursorPos(2,4)
  132.         while p>4 do
  133.                 p = p-4
  134.                 write('=')
  135.         end
  136. end
  137.  
  138. term.setCursorPos(13,5)
  139. term.clearLine()
  140. print('100%')
  141. print()
  142. print('Mining complete.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement