TheSwiftVlogger

Simple Strip mine BETA

Mar 1st, 2014
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.50 KB | None | 0 0
  1. --[[
  2.         ** Simple StripMine BETA**
  3.         ** Written by: TheSwiftVlogger **
  4.         Warning: Bugs and errors are still occurring
  5.        
  6.         *CHANGE LOG*
  7.        
  8.         version 0.0.1:
  9.             - System booting intro added
  10.             - added fuel check
  11.        
  12.         version 0.1.0
  13.             - Bug fixes
  14.             - added sand/gravel protection
  15.            
  16.         version 0.1.10
  17.             - Complete re-written and restructured code
  18.            
  19.         Current bugs
  20.             - torches not placing
  21.  
  22.            
  23. ]]--
  24.  
  25. local sd = "Place fuel in slot 1, torches in slot 2"
  26. local ss = "Welcome, booting system, please hold.."
  27. local ld = "Loading required drivers"
  28. local cf = "Checking fuel levels."
  29. local fr = "Fuel remaining: "
  30. local gf = turtle.getFuelLevel()
  31. local pe = "press <Enter> to continue"
  32.  
  33. function intro()    --simple cosmetic intro
  34. term.clear()
  35. term.setCursorPos(1, 1)
  36. print(sd)
  37. sleep(1)
  38. term.setCursorPos(5, 7)
  39. print(pe)
  40.     x = read()
  41. term.clear()
  42. term.setCursorPos(1, 1)
  43.     print(ss)
  44.         sleep(3)
  45. term.setCursorPos(1, 2)
  46.     print(cf)
  47.         sleep(1.2)
  48. term.setCursorPos(1, 3)
  49.     print(fr.." "..gf)
  50.         sleep(1)
  51. term.setCursorPos(5, 7)
  52.     print(pe)
  53.     x = read()
  54. term.clear()
  55. term.setCursorPos(1, 1)
  56. end
  57.  
  58. local ac = "How Long to mine? "     -- not function yet*
  59.  
  60. function input()
  61.        --for future plans* 
  62. end
  63.  
  64. function cFuel()            --check fuel level, if below 30 will automatically refuel
  65.     if turtle.getFuelLevel() < 29 then
  66.         turtle.refuel(1)
  67.     elseif turtle.getFuelLevel() > 30 then
  68.         write("Fuel is over 30, no need to refuel")
  69.         sleep(1.6)
  70.         term.clear()
  71.     end
  72. end
  73.    
  74. function mine()     --the function for mining, to 100 block long strips. with sand/gravel protection
  75.     if turtle.detect() then
  76.         turtle.dig()
  77.         sleep(.5)
  78.     end
  79.     turtle.digUp()
  80.     turtle.digDown()
  81.     turtle.forward()
  82.    
  83. end
  84.  
  85.  
  86.    
  87. intro()
  88. cFuel()
  89. input()     --nothing yet
  90.                     --script starts here
  91. while true do
  92.  
  93.  
  94. if i%6 == 0 then          -- problem is here   
  95.         turtle.select(2)
  96.         turtle.placeDown()
  97.         turtle.select(1)
  98. end
  99.    
  100. for i = 1, 100 do          
  101.    
  102.     mine()
  103. end
  104.  
  105. turtle.turnRight()  --turns right to start a new strip, leaves 2 rows then mines.
  106.  
  107. for i = 1, 3 do
  108.     if turtle.detect() then
  109.         turtle.dig()
  110.         sleep(.5)
  111.     end
  112.     turtle.digUp()
  113.     turtle.digDown()
  114.     turtle.forward()
  115. end
  116.  
  117. turtle.turnRight()
  118.  
  119. for i = 1, 100 do   --mines for another 100 blocks
  120.    
  121.     mine()
  122. end
  123.  
  124. turtle.turnLeft()       -- turns left to mine a new column (zig-zag look)
  125.  
  126. for i = 1, 3 do
  127.     if turtle.detect() then
  128.         turtle.dig()
  129.         sleep(.5)
  130.     end
  131.     turtle.digUp()
  132.     turtle.digDown()
  133.     turtle.forward()
  134. end
  135.  
  136. turtle.turnLeft()      
  137. end
Advertisement
Add Comment
Please, Sign In to add comment