daily pastebin goal
19%
SHARE
TWEET

Better Mine (Computercraft)

Minimine Apr 16th, 2018 (edited) 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function onEnd()
  2.     if turtle.getFuelLevel() < 5000 then
  3.         shell.run("refuel all")
  4.     end
  5.     turtle.select(1)
  6.     while turtle.detect() do
  7.         turtle.dig()
  8.         os.sleep(0.3)
  9.     end
  10.    
  11.     turtle.place()
  12.    
  13.     for i=2,16,1 do
  14.            
  15.         turtle.select(i)
  16.         turtle.drop()
  17.        
  18.     end
  19.     turtle.select(1)
  20.     turtle.dig()
  21. end
  22.  
  23. -- Presetup
  24. if not fs.exists("appdata") then
  25.     fs.makeDir("appdata")
  26. end
  27.  
  28. if not fs.exists("appdata/bettermine") then
  29.     fs.makeDir("appdata/bettermine")
  30. end
  31.  
  32. local xfile = fs.open("appdata/bettermine/x", "w")
  33. local yfile = fs.open("appdata/bettermine/y", "w")
  34.  
  35. local x = tonumber(xfile.readAll());
  36. local y = tonumber(yfile.readAll());
  37.  
  38. -- Programm
  39. turtle.select(1)
  40. shell.run("clear")
  41. if turtle.getFuelLevel() < 5000 then
  42.     print("Not enough fuel, please put in fuel, it will be filled in automatically")
  43. end
  44. while turtle.getFuelLevel() < 5000 do
  45.     turtle.refuel(64)
  46. end
  47. turtle.select(1)
  48. if turtle.getItemSpace(1) > 63 then
  49.     print("Please insert a enderchest into the first slot!")
  50. end
  51. while turtle.getItemSpace(1) > 63 do
  52.     os.sleep(0.2)
  53. end
  54. shell.run("clear")
  55. while true do
  56.  
  57.     while turtle.detect() do
  58.         turtle.dig()
  59.         os.sleep(0.3)
  60.     end
  61.    
  62.     turtle.forward()
  63.    
  64.     for i=0,4,1 do
  65.         while turtle.detectDown() do
  66.             turtle.digDown()
  67.             os.sleep(0.3)
  68.         end
  69.         turtle.down()
  70.     end
  71.    
  72.     turtle.turnLeft()
  73.    
  74.     for i=0,4,1 do
  75.         while turtle.detect() do
  76.             turtle.dig()
  77.             os.sleep(0.3)
  78.         end
  79.         turtle.forward()
  80.     end
  81.    
  82.     turtle.turnLeft()
  83.     turtle.turnLeft()
  84.    
  85.     for i=0,9,1 do
  86.         while turtle.detect() do
  87.             turtle.dig()
  88.             os.sleep(0.3)
  89.         end
  90.         turtle.forward()
  91.     end
  92.        
  93.     turtle.turnLeft()
  94.     turtle.turnLeft()
  95.    
  96.     for i=0,8,1 do
  97.    
  98.         while turtle.detectUp() do
  99.             turtle.digUp()
  100.             os.sleep(0.3)
  101.         end
  102.         turtle.up()
  103.        
  104.         for i=0,9,1 do
  105.             while turtle.detect() do
  106.                 turtle.dig()
  107.                 os.sleep(0.3)
  108.             end
  109.             turtle.forward()
  110.         end
  111.        
  112.         turtle.turnLeft()
  113.         turtle.turnLeft()
  114.     end
  115.    
  116.     for i=0,4,1 do
  117.         while turtle.detect() do
  118.             turtle.dig()
  119.             os.sleep(0.3)
  120.         end
  121.         turtle.forward()
  122.     end
  123.    
  124.     for i=0,3,1 do
  125.         while turtle.detectDown() do
  126.             turtle.digDown()
  127.             os.sleep(0.3)
  128.         end
  129.         turtle.down()
  130.     end
  131.     turtle.turnLeft()
  132.    
  133.     onEnd()
  134. end
RAW Paste Data
Top