Posted 29 September 2012 - 10:41 AM
So I'm making a cobble miner and I just want him to mine cobble when he detects some infront of him, and when all 16 slots are full dropping his inventory into my storage system.
Now I have no problem with the detecting and then digging, but to find if the inventory is full is the bit I'm having trouble with.
I can see 2 ways to do this:
1, store the number of times turtle has mined in a variable, and once equal to 1024 then dumping inventory.
2, nesting if statements checking all slots and if all slots are full then running the dump procedure.
But these are both quite complicated awkward ways of doing it, is there an easier way?
Thanks in advance :P/>/>
EDIT: I nested the if statements just to see how silly it would look:
It formats it a bit strange when I copy it in to here
Now I have no problem with the detecting and then digging, but to find if the inventory is full is the bit I'm having trouble with.
I can see 2 ways to do this:
1, store the number of times turtle has mined in a variable, and once equal to 1024 then dumping inventory.
2, nesting if statements checking all slots and if all slots are full then running the dump procedure.
But these are both quite complicated awkward ways of doing it, is there an easier way?
Thanks in advance :P/>/>
EDIT: I nested the if statements just to see how silly it would look:
Spoiler
local function invDump()
for i = 1, 16 do
turtle.select(i)
turtle.dropDown()
end
end
while true do
if turtle.detect() then
turtle.dig()
end
if turtle.getItemCount(1) == 64 then
if turtle.getItemCount(2) == 64 then
if turtle.getItemCount(3) == 64 then
if turtle.getItemCount(4) == 64 then
if turtle.getItemCount(5) == 64 then
if turtle.getItemCount(6) == 64 then
if turtle.getItemCount(7) == 64 then
if turtle.getItemCount(8) == 64 then
if turtle.getItemCount(9) == 64 then
if turtle.getItemCount(10) == 64 then
if turtle.getItemCount(11) == 64 then
if turtle.getItemCount(12) == 64 then
if turtle.getItemCount(13) == 64 then
if turtle.getItemCount(14) == 64 then
if turtle.getItemCount(15) == 64 then
if turtle.getItemCount(16) == 64 then
invDump()
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
It formats it a bit strange when I copy it in to here