daily pastebin goal
76%
SHARE
TWEET

Untitled

a guest Dec 16th, 2018 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local depth = 0
  2. local isJunk = true
  3.  
  4. function fuel()
  5.     if turtle.getFuelLevel() < 20 then
  6.         turtle.select(16)
  7.         turtle.refuel(1)
  8.     end
  9. end
  10. function up()
  11.     fuel()
  12.     if turtle.up() then
  13.         return true
  14.         depth = depth - 1
  15.     else
  16.         return false
  17.     end
  18. end
  19. function down()
  20.     fuel()
  21.     if turtle.down() then
  22.         return true
  23.         depth = depth + 1
  24.     else
  25.         return false
  26.     end
  27. end
  28. function checkWalls()
  29.     for i = 1,4 do
  30.         for j = 1,6 do
  31.             turtle.select(i)
  32.             if turtle.compare() then
  33.                 isJunk = true
  34.             end
  35.         end
  36.         if isJunk == false then
  37.             turtle.dig()
  38.         end
  39.         turtle.turnLeft()
  40.     end
  41. end
  42. function digDown()
  43.     for k = 1,6 do
  44.         turtle.select(k)
  45.         if turtle.compareDown() then
  46.             if turtle.digDown() then
  47.                 return true
  48.             else
  49.                 return false
  50.             end
  51.         end
  52.     end
  53.     turtle.select(1)
  54.     turtle.digDown()
  55. end
  56. function digUp()
  57.     for l = 1,6 do
  58.         turtle.select(l)
  59.         if turtle.compareUp() then
  60.             if turtle.digUp() then
  61.                 return true
  62.             else
  63.                 return false
  64.             end
  65.         end
  66.     end
  67.     turtle.select(1)
  68.     turtle.digUp()
  69. end
  70.  
  71. while true do
  72.     term.clear()
  73.     term.setCursorPos(1,1)
  74.     print("-------Mining Operation Alpha-------")
  75.     term.setCursorPos(1,2)
  76.     term.write("Commence Mining Operation? (y/n): ")
  77.  
  78.     local input = read()
  79.  
  80.     if input  == "n" then
  81.         term.setCursorPos(1,3)
  82.         print("Cancelling Operation")
  83.         sleep(1)
  84.         exit()
  85.     elseif input == "y" then
  86.         term.setCursorPos(1,3)
  87.         print("Commencing Alpha Mine")
  88.         sleep(1)
  89.      end
  90.  
  91.     digDn()
  92.     down()
  93.     digDn()
  94.     down()
  95.     turtle.select(7)
  96.     turtle.placeUp()
  97.     checkWalls()
  98.     digDn()
  99.     while down() do
  100.         checkWalls()
  101.         digDn()
  102.     end
  103.     up()
  104.     turtle.select(15)
  105.     turtle.placeDown()
  106.     for m = 1,5 do
  107.         up()
  108.     end
  109.     turtle.dig()
  110.     fuel()
  111.     turtle.forward()
  112.     turtle.dig()
  113.     fuel()
  114.     turtle.forward()
  115.     turtle.turnRight()
  116.     turtle.dig()
  117.     fuel()
  118.     turtle.forward()
  119.     turtle.turnLeft()
  120.     digDn()
  121.     while down() do
  122.         digdn()
  123.     end
  124.     checkWalls()
  125.     up()
  126.     turtle.select(15)
  127.     turtle.placeDown()
  128.     checkWalls()
  129.     while depth > 1 do
  130.         digUp()
  131.         up()
  132.         checkWalls()
  133.     end
  134.     digUp()
  135.     up()
  136.     up()
  137.     turtle.select(7)
  138.     turtle.placeDown()
  139.     fuel()
  140.     turtle.forward()
  141.     turtle.forward()
  142.     turtle.turnRight()
  143.     turtle.forward()
  144.     turtle.turnLeft()
  145. end
  146.    
  147. bios.lua:26: [string "mine.lua"]:14: 'end' expected (to close 'if' at line 12)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top