-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathturtle.autocompress.lua
More file actions
62 lines (50 loc) · 1.04 KB
/
turtle.autocompress.lua
File metadata and controls
62 lines (50 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
print("Terminate program: CTRL+T")
itemnum=8
print("Iten Amount: ",itemnum)
for i=1,16 do
turtle.select(i)
turtle.drop()
end
sleep(1)
slot=1
turtle.select(slot)
----------------------------------
--Crafting
while 0 do
sleep(1)
slot=turtle.getSelectedSlot()
while slot<12 do
success,errormsg=turtle.suckDown(itemnum)
if turtle.getItemCount(slot)<itemnum then
nowitemnum=turtle.getItemCount(slot)
print("Items are too few: slot ",slot,", amount ",nowitemnum)
while nowitemnum<=itemnum-1 do
sleep(1)
nowitemnum=turtle.getItemCount(slot)
sleep(1)
success,errormsg=turtle.suckDown(itemnum-nowitemnum)
end
end
if success then
slot=slot+1
if slot==4 then
slot=5
elseif slot==8 then
slot=9
end
end
turtle.select(slot)
end
turtle.select(11)
success,errormsg=turtle.craft(8)
sleep(1)
if success==false then
for i=1,16 do
turtle.select(i)
turtle.drop()
end
else
turtle.drop()
end
turtle.select(1)
end