View difference between Paste ID: 37yNRyj0 and Zgubz2y8
SHOW: | | - or go back to the newest paste.
1
p = peripheral.wrap("front")
2-
2+
turtle.select(12)
3
items = p.getAllStacks()
4
turtleDir = ("West")
5
quantity = 0
6-
6+
7
 
8-
  	for i=1, p.getInventorySize() do
8+
9-
		if p.getStackInSlot(i) ~= nil then
9+
items = {}
10-
    		quantity = p.getStackInSlot(i).qty
10+
    for i=1, p.getInventorySize() do
11-
			--if quantity >= 9 then
11+
        if p.getStackInSlot(i) ~= nil then
12-
			if quantity >= 4 then
12+
            quantity = p.getStackInSlot(i).qty
13-
				doCrafting(i, quantity)
13+
            --if quantity >= 9 then
14-
				print("crafting")
14+
            if quantity >= 4 then
15-
			end
15+
                doCrafting(i, quantity)
16-
		end
16+
                print("crafting")
17-
	end
17+
            end
18
        end
19-
19+
    end
20
end
21-
	--craftNr = math.floor(n / 9)
21+
 
22-
	craftNr = math.floor(n / 4)
22+
function getStacksxx(_index)
23-
	p.pushItemIntoSlot(turtleDir,slot,craftNr, 1)
23+
    items = p.getAllStacks()
24-
	p.pushItemIntoSlot(turtleDir,slot,craftNr, 2)
24+
    if items[_index] ~= nil then
25-
	p.pushItemIntoSlot(turtleDir,slot,craftNr, 5)
25+
        quantity = items[_index]["qty"]
26-
	p.pushItemIntoSlot(turtleDir,slot,craftNr, 6)
26+
    end
27-
	--p.pushItemIntoSlot(turtleDir,slot,craftNr, 3)
27+
    --if quantity >= 9 then
28-
	--p.pushItemIntoSlot(turtleDir,slot,craftNr, 7)
28+
    if quantity >= 4 then
29-
	--p.pushItemIntoSlot(turtleDir,slot,craftNr, 9)
29+
        doCrafting(_index, quantity)
30-
	--p.pushItemIntoSlot(turtleDir,slot,craftNr, 10)
30+
        print("crafting")
31-
	--p.pushItemIntoSlot(turtleDir,slot,craftNr, 11)
31+
    end
32-
	turtle.craft()
32+
33-
	turtle.dropUp()
33+
 
34
function doCrafting(slot, n)
35-
35+
    --craftNr = math.floor(n / 9)
36-
36+
    craftNr = math.floor(n / 4)
37-
37+
    p.pushItemIntoSlot(turtleDir,slot,craftNr, 1)
38
    p.pushItemIntoSlot(turtleDir,slot,craftNr, 2)
39-
	getStacks()
39+
    p.pushItemIntoSlot(turtleDir,slot,craftNr, 5)
40-
	p.condenseItems()
40+
    p.pushItemIntoSlot(turtleDir,slot,craftNr, 6)
41-
	print("waiting 1")
41+
    --p.pushItemIntoSlot(turtleDir,slot,craftNr, 3)
42-
	os.sleep(0.4)
42+
    --p.pushItemIntoSlot(turtleDir,slot,craftNr, 7)
43
    --p.pushItemIntoSlot(turtleDir,slot,craftNr, 9)
44
    --p.pushItemIntoSlot(turtleDir,slot,craftNr, 10)
45
    --p.pushItemIntoSlot(turtleDir,slot,craftNr, 11)
46
    turtle.craft()
47
    turtle.dropUp()
48
end
49
 
50
 
51
 
52
while true do
53
    getStacks()
54
    p.condenseItems()
55
    --print("waiting 1")
56
    --os.sleep(0)
57
end