Advertisement
Guest User

Tunnelturtle Proto

a guest
Mar 30th, 2020
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.36 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.                 if turtle.compareDown(2) == false then
  61.                     turtle.select(3)
  62.                     while turtle.placeDown() == false do
  63.                         turtle.digDown()
  64.                         turtle.attackDown()
  65.                     end
  66.                 else
  67.                 end
  68.         else
  69.         end
  70. end    
  71.  
  72.  
  73. clearConsole()
  74. write('Wie weit nach vorne? ')
  75. x = read()
  76. j = 0
  77. clearConsole()
  78. print('Programm in Arbeit...')
  79. print()
  80. print()
  81. print('<                         >')
  82. term.setCursorPos(13,5)
  83. print('0%')
  84.  
  85. for i=1,x-1 do
  86.         if j%11 == 0 then
  87.                 turtle.turnRight()
  88.                 turtle.turnRight()
  89.                 turtle.select(16)
  90.                 turtle.place()
  91.                 turtle.select(1)
  92.                 turtle.turnRight()
  93.                 turtle.turnRight()
  94.         elseif (j-5)%11 == 0 then
  95.                 turtle.turnRight()
  96.                 turtle.turnRight()
  97.                 turtle.select(16)
  98.                 turtle.place()
  99.                 turtle.select(1)
  100.                 turtle.turnRight()
  101.                 turtle.turnRight()
  102.         end
  103.         j = j+1
  104.         turtleFore()
  105.         compareDown()
  106.         turtleUp()
  107.         turtleUp()
  108.         turtleLeft()
  109.         turtle.turnRight()
  110.         turtleDown()
  111.         turtle.turnLeft()
  112.         turtleDown()
  113.         compareDown()
  114.         turtle.turnRight()
  115.         turtle.turnRight()
  116.         turtleFore()
  117.         turtleFore()
  118.         compareDown()
  119.         turtle.turnLeft()
  120.         turtleUp()
  121.         turtle.turnRight()
  122.         turtleUp()
  123.         turtle.turnLeft()
  124.         turtle.turnLeft()
  125.         turtleFore()
  126.         turtle.turnRight()
  127.         turtleDown()
  128.         turtleDown()
  129.        
  130.         p = (i/x-(i/x)%0.0001)*100
  131.         term.setCursorPos(13,5)
  132.         n = tostring(p)
  133.         term.clearLine()
  134.         print(n .. '%')
  135.         term.setCursorPos(2,4)
  136.         while p>4 do
  137.                 p = p-4
  138.                 write('=')
  139.         end
  140. end
  141.  
  142. term.setCursorPos(13,5)
  143. term.clearLine()
  144. print('100%')
  145. print()
  146. print('Programm beendet.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement