Advertisement
Guest User

M

a guest
Jun 24th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.72 KB | None | 0 0
  1. turtle.refuel()
  2. SETL = 0 -- How far seting
  3. SETW = 0 -- How wide seting
  4. SETH = 0 -- How tall seting
  5. L = 1 -- Far dis.
  6. W = 0 -- Wide dis.
  7. H = 0 -- Tall dis.
  8. SL = 0 -- secondary Demenchons
  9. SW = 0
  10. SH = 0
  11. ----
  12. UPDown = 1 -- If going up up then 0
  13. ----
  14. LeftRight = 0 -- Tells which way it is going 0=Right
  15. Start = 1
  16. ----
  17. EP = 1 -- If At End Pont 0 = false
  18. ----
  19. FL = 0 -- FuelLevel
  20.  
  21. GOOD = "Y"
  22. BAD = "N"
  23. --------
  24. while true do
  25.   term.clear()
  26.   term.setCursorPos(1,1)
  27.  
  28.   print("How Deep Do You Want To Go?")
  29.   print(">")
  30.   term.setCursorPos(2,2)
  31.   SETL = io.read()
  32.   term.setCursorPos(1,1)
  33.   term.clear()
  34.  
  35.   print("The Turtle Will go "..SETL.." Blocks")
  36.   print("Are You Sure? Input = "..SETL)
  37.   print(">")
  38.   term.setCursorPos(2,3)
  39.   Input = io.read()
  40.   if Input == GOOD then
  41.     term.clear()
  42.     term.setCursorPos(1,1)
  43.     print("Inputing")
  44.     sleep(.5)
  45.     break
  46.   end
  47.  
  48.   if Input == BAD then
  49.     term.clear()
  50.     term.setCursorPos(1,1)
  51.     print("Undoing Input")
  52.     sleep(.5)
  53.   end
  54.  
  55.   if Input ~= Good or Input ~= BAD then
  56.     term.clear()
  57.     term.setCursorPos(1,1)
  58.     print("Invaled Input")
  59.     sleep(.5)
  60.   end
  61. end
  62.  
  63. term.clear()
  64. term.setCursorPos(1,1)
  65. while true do
  66.   print("How Tall Do You Want The Tunnel?")
  67.   print(">")
  68.   term.setCursorPos(2,2)
  69.   SETH = io.read()
  70.   term.clear()
  71.   term.setCursorPos(1,1)
  72.  
  73.   print("The Turtle Will Go "..SETH.." Blocks Tall")
  74.   print("Are You Sure? Input = "..SETH)
  75.   print(">")
  76.   term.setCursorPos(2,3)
  77.   Input = io.read()
  78.   term.clear()
  79.   term.setCursorPos(1,1)
  80.  
  81.   if Input == GOOD then
  82.     print("Inputing")
  83.     sleep(.5)
  84.     break
  85.   end
  86.  
  87.   if Input == BAD then
  88.     print("Undoing Input")
  89.     sleep(.5)
  90.   end
  91.  
  92.   if Input ~= GOOD or Input ~= BAD then
  93.     print("Invaled Input")
  94.     sleep(.5)
  95.   end
  96. end
  97.  
  98. while true do
  99. term.clear()
  100. term.setCursorPos(1,1)
  101.  print("How Wide Do You Want The Tunnel?")
  102.  print(">")
  103.  term.setCursorPos(2,2)
  104.  SETW = io.read()
  105.  
  106.  break
  107. end
  108. function Left()
  109.   turtle.turnLeft()
  110. end
  111.  
  112. function Right()
  113.   turtle.turnRight()
  114. end
  115.  
  116. function UPCheck()
  117.   if turtle.detectUp() == true then
  118.     UpDetect = 1
  119.   else
  120.     UpDetect = 0
  121.   end
  122. end
  123.  
  124. function FORWARDCheck()
  125.   if turtle.detect() == true then
  126.     ForwardDetect = 1
  127.   else
  128.     ForwardDetect = 0
  129.   end
  130. end
  131.  
  132. function Start()
  133.   FORWARDCheck()
  134.   while true do
  135.     if ForwardDetect == tonumber(0) then
  136.       turtle.forward()
  137.     else
  138.       break
  139.     end
  140.     FORWARDCheck()
  141.   end
  142. end
  143.  
  144. function MineUP()
  145.   while H ~= SETH-1 do
  146.   UPCheck()
  147.     while UpDetect == tonumber(1) do
  148.       turtle.digUp()
  149.       sleep(.4)
  150.       UPCheck()
  151.     end
  152.  
  153.     if H < tonumber(SETH) then
  154.       turtle.up()
  155.       H = H+1
  156.     end
  157.   end
  158. end
  159.  
  160. function MineDOWN()
  161.   while H ~= tonumber(0) do
  162.     turtle.digDown()
  163.     if H > tonumber(0) then
  164.       turtle.down()
  165.       H = H-1
  166.     end
  167.   end
  168. end
  169.  
  170. function MineForward()
  171.   FORWARDCheck()
  172.   while ForwardDetect == tonumber(1) do
  173.     turtle.dig()
  174.     sleep(.4)
  175.     FORWARDCheck()
  176.   end
  177.   turtle.forward()
  178. end
  179. END2 = 0
  180.  
  181. Start()
  182. MineForward()
  183. turtle.turnRight()
  184. LeftRight = 0
  185. --------
  186.   function Layer()
  187.   Start = 0
  188.     W = 0
  189.     EP = 0
  190.     if L ~= tonumber(SETL) then
  191.       END = 0
  192.     else
  193.       END2 = 1
  194.     end
  195.    
  196.     if END == tonumber(0) then
  197.       while W ~= tonumber(SETW) do
  198.         if UPDown == tonumber(1) then
  199.           MineUP()
  200.           UPDown = 0
  201.         else
  202.           MineDOWN()
  203.           UPDown = 1
  204.         end
  205.        
  206.         if SETW ~= tonumber(0) then
  207.           if W == tonumber(SETW - 1) then
  208.             break
  209.           else
  210.             MineForward()
  211.             W = W + 1
  212.           end
  213.         end
  214.       end
  215.     if END2 == tonumber(1) then
  216.       END = 1
  217.     end
  218.     EP = 1
  219.     end  
  220.   end
  221.  
  222. function EPLeft()
  223.   if EP == tonumber(1) and L ~= tonumber(SETL) and Start == tonumber(0) then
  224.     Left()
  225.     MineForward()
  226.     L = L + 1
  227.     Left()
  228.     LeftRight = 1
  229.   end
  230. end
  231.  
  232. function EPRight()
  233.   if EP == tonumber(1) and L ~= tonumber(SETL) then
  234.     Right()
  235.     MineForward()
  236.     L = L + 1
  237.     Right()
  238.     LeftRight = 0
  239.   end
  240. end
  241. --------
  242. while true do
  243.   while L ~= tonumber(SETL) do
  244.     if UPDown == tonumber(1) and LeftRight == tonumber(0) and L < tonumber(SETL + 1) then
  245.       EPLeft()
  246.       Layer()
  247.     end
  248.  
  249.     if UPDown == tonumber(0) and LeftRight == tonumber(0) and L < tonumber(SETL + 1) then
  250.       EPLeft()
  251.       Layer()
  252.     end
  253.    
  254.     if UPDown == tonumber(0) and LeftRight == tonumber(1) and L < tonumber(SETL + 1) then
  255.       EPRight()
  256.       Layer()
  257.     end
  258.  
  259.     if UPDown == tonumber(1) and LeftRight == tonumber(1) and L < tonumber(SETL + 1) then
  260.       EPRight()
  261.       Layer()
  262.     end
  263.   end
  264.  
  265. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement