View difference between Paste ID: vVdvCHzF and mFQ7ea4Z
SHOW: | | - or go back to the newest paste.
1
-- Script created by Zehdari
2
 
3
-- Setting the height to 0
4
local height = 0
5
 
6
-- Creating the refuel function
7
local function refuel()
8
 if turtle.getFuelLevel() < 20 then
9
  for a = 1,16 do
10
   if turtle.getFuelLevel() < 20 then
11
    turtle.select(a)
12
    if turtle.refuel(a) then
13
     for q = 1, turtle.getItemCount(a) do
14
      if turtle.getFuelLevel() < 20 then
15
       turtle.refuel(a)
16
      end
17
     end
18
    end
19
   end
20
  end
21
  turtle.select(1)
22
 end
23
end
24
 
25
-- Saying that the script has started
26
print "Cutting..."
27
 
28
-- Creating the beginning cut function
29
local function cut()
30
 turtle.dig()
31
 refuel()
32
 turtle.forward()
33
 turtle.dig()
34
end
35
 
36
-- Creating the function to cut upwards, until reaching the top
37
local function detectup()
38
 while turtle.detectUp() do
39
  turtle.digUp()
40
  refuel()
41
  turtle.up()
42
  turtle.dig()
43
  height = height + 1
44
 end
45
end
46
 
47
-- Creating the function to turn once reached the top
48
local function turn()
49
 turtle.turnRight()
50
 turtle.dig()
51
 refuel()
52
 turtle.forward()
53
 turtle.turnLeft()
54
end
55
 
56
-- Creating the function to dig and go downwards
57
local function down()
58
 for i = 1,height do
59
  turtle.dig()
60
  turtle.digDown()
61
  refuel()
62
  turtle.down()
63
 end
64
end
65
 
66
-- Calling the functions
67
cut()
68
detectup()
69
turn()
70
down()
71
turtle.dig()
72
 
73
-- Info for the owner
74-
print "Tree cut successfully."
74+