View difference between Paste ID: bGgVnmvc and nhysDbv4
SHOW: | | - or go back to the newest paste.
1
chestFull = false
2-
    for i=1,3 do
2+
3
function fillSlots(start, finish)
4-
        turtle.suck()
4+
	for i=start,finish do
5
        turtle.select(i)
6
		while turtle.getItemCount() < 64 do
7-
    for j=9,11 do
7+
        	turtle.suck(64-turtle.getItemCount())
8-
        turtle.select(j)
8+
		end
9-
        turtle.suck()
9+
10
end
11
12
function emptyInventory()
13
	for i=1,16 do
14-
    for i=5,7 do
14+
15
		item = turtle.getItemDetail()
16-
        turtle.suck()
16+
		if item and item.name == "ic2:itemcable" then
17
        	dropped, message = turtle.dropDown()
18
19
			if not dropped then
20
				chestFull = true
21
				return
22
            else
23-
    for i=1,16 do
23+
                chestFull = false
24
			end
25-
        turtle.dropDown()
25+
		end
26
    end
27
end
28
29
function craftCircuit()
30
    fillSlots(1, 3)
31
    fillSlots(9, 11)
32
    
33
    turtle.turnLeft()
34
35
    fillSlots(5, 7)
36
    
37
    turtle.turnRight()
38
39
    turtle.craft()
40
end
41
42
while true do
43
	while redstone.getInput("back") and not chestFull do
44
        emptyInventory()
45
		if not chestFull then
46
			craftCircuit()
47
		end
48
	end
49
	sleep(1)
50
end