ConorYoungs

3x3 Tunnel Computer Craft Script

Apr 10th, 2021
803
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. print("Conor's mining program!!")
  2. print("Please place turtle at bottom left of 3x3")
  3. write("Please enter the length of the 3x3 tunnel: ")
  4. local number = tonumber(read())
  5.  
  6. local function mineForward()
  7.     while turtle.detect() do
  8.         turtle.dig()
  9.         sleep(0.5)
  10.     end
  11. end
  12.  
  13. local function checkFuel()
  14.     if turtle.getFuelLevel() < 200 then
  15.         for i = 1, 16 do
  16.             turtle.select(i)
  17.             if turtle.refuel(0) then
  18.                 turtle.refuel(1)
  19.             end
  20.         end
  21.     end
  22. end
  23.  
  24. local function returnHome(number)
  25.     for i = 1, number do
  26.         checkFuel()
  27.         turtle.back()
  28.     end
  29. end
  30.  
  31. local function threeByThree(number)
  32.     for i = 1, number do
  33.         checkFuel()
  34.  
  35.         -- go to bottom left corner and position
  36.         mineForward()
  37.         turtle.forward()
  38.         turtle.turnRight()
  39.  
  40.         -- remove left column of 3x3
  41.         turtle.digUp()
  42.         turtle.up()
  43.         turtle.digUp()
  44.         turtle.up()
  45.  
  46.         -- go to top middle of 3x3
  47.         mineForward()
  48.         turtle.forward()
  49.         mineForward()
  50.  
  51.         -- remove the 2nd and 3rd columns
  52.         turtle.digDown()
  53.         turtle.down()
  54.         mineForward()
  55.         turtle.digDown()
  56.         turtle.down()
  57.         mineForward()
  58.  
  59.         -- go back to bottom left of 3x3
  60.         turtle.back()
  61.         turtle.turnLeft()
  62.     end
  63.  
  64.     returnHome(number)
  65. end
  66.  
  67. threeByThree(number)
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×