Zehdari

Untitled

Jul 26th, 2013
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- Script created by Zehdari
  2. -- <3 Tibbzeh
  3. -- #ForceLove
  4.  
  5. -- Setting the height to 0
  6. local height = 0
  7.  
  8. -- Creating the refuel function
  9. local function refuel()
  10.  if turtle.getFuelLevel() < 20 then
  11.   for a = 1,16 do
  12.    if turtle.getFuelLevel() < 20 then
  13.     turtle.select(a)
  14.     if turtle.refuel(a) then
  15.      for q = 1, turtle.getItemCount(a) do
  16.       if turtle.getFuelLevel() < 20 then
  17.        turtle.refuel(a)
  18.       end
  19.      end
  20.     end
  21.    end
  22.   end
  23.   turtle.select(1)
  24.  end
  25. end
  26.  
  27. -- Saying that the script has started
  28. print "Cutting..."
  29.  
  30. -- Creating the beginning cut function
  31. local function cut()
  32.  turtle.dig()
  33.  refuel()
  34.  turtle.forward()
  35.  turtle.dig()
  36. end
  37.  
  38. -- Creating the function to cut upwards, until reaching the top
  39. local function detectup()
  40.  while turtle.detectUp() do
  41.   turtle.digUp()
  42.   refuel()
  43.   turtle.up()
  44.   turtle.dig()
  45.   height = height + 1
  46.  end
  47. end
  48.  
  49. -- Creating the function to turn once reached the top
  50. local function turn()
  51.  turtle.turnRight()
  52.  turtle.dig()
  53.  refuel()
  54.  turtle.forward()
  55.  turtle.turnLeft()
  56. end
  57.  
  58. -- Creating the function to dig and go downwards
  59. local function down()
  60.  for i = 1,height do
  61.   turtle.dig()
  62.   turtle.digDown()
  63.   refuel()
  64.   turtle.down()
  65.  end
  66. end
  67.  
  68. -- Calling the functions
  69. cut()
  70. detectup()
  71. turn()
  72. down()
  73. turtle.dig()
  74.  
  75. -- Info for the owner
  76. print ("Fuel level is: "..turtle.getFuelLevel())
Advertisement
Add Comment
Please, Sign In to add comment