View difference between Paste ID: GJdyWE3P and Kz0HAwU3
SHOW: | | - or go back to the newest paste.
1
--[[Author: Sandbag
2
        Simple script that digs UPWARDS, the size you specify.
3
 
4
        TO DO:
5
                -better fuel management
6
                -chest dumps
7
pastebin get Kz0HAwU3 digup                 
8
9
]]
10
 
11
 
12
function checkfuel()
13
local fuel=tonumber(turtle.getFuelLevel())
14
        if fuel < 70
15
        then
16
                print("************")
17
                print("*")
18
                print("*")
19
                print("* Need Fuel!!")         
20
                print("*")
21
                print("*")
22
                print("* Place Coal in slot 1")
23
                print("************")
24
               
25
        end
26
 
27
end
28
 
29
checkfuel()
30
 
31
io.write("Blocks in front of turtle? : ")
32
y = tonumber(io.read())
33
 
34
io.write("Blocks to the right? : ")
35
x = tonumber(io.read())
36
 
37
io.write("How High? : ")
38
z = tonumber(io.read())
39
 print (x..", "..y..", "..z)
40
 
41
function refueling()
42
        print("Refueling from slot 1")
43
        turtle.select(1)
44
        turtle.refuel()
45
end
46
 
47
 
48
 
49
function bore() --[dig up]
50
        local height = z-1
51
        while height > 0 do
52
                turtle.digUp()
53
                turtle.up(1)
54
                height = height-1
55
        end
56
       
57
        for i = 1 , z-1 do
58
                turtle.down()
59
        end
60
end
61
 
62
function ydig() --[dig out]
63
        local ydig = y
64
        while ydig > 0 do
65
                bore()
66
                if ydig > 1 
67
			then
68
			if turtle.detect()
69
                        	then
70
                        	turtle.dig()
71
                	end
72
		end
73
                turtle.forward(1)
74
                ydig = ydig-1
75
        end
76
       
77
        for i = 1,y-1 
78
		do
79
                	turtle.back()
80
        	end
81
       
82
       
83
end
84
 
85
 
86
function turn()
87
        turtle.turnRight()
88
        if turtle.detect()
89
                then
90
                        turtle.dig()
91
                end
92
        turtle.forward()
93
        turtle.turnLeft()
94
end
95
function xcavate() --[dig across]
96
        local xdig = tonumber(x)
97
               
98
        while xdig > 0 do      
99
                if tonumber(turtle.getFuelLevel()) < 70
100
                        then
101
                                refueling()
102
                        end
103
                ydig()         
104
                if xdig > 1 
105
			then
106
				turn() 
107
			end
108
		
109
                xdig = xdig-1
110
        end
111
end
112
 
113
xcavate()