Posted 29 May 2013 - 02:34 PM
So I'm working on a set of programs to get a mining turtle to build my base for me. I have the main bulk of the program sorted of digging out blocks in the way and building up the structure. However, I'm stuck on trying to work out how to refill slots of the turtle.
For the building, I have slot 1 with fuel, slot 2 with floor material, slot 3 with wall material, and slot 4 with glass. I want to have slot 5 be an ender chest which has more of the relevant material in it, and for the turtle to automatically restock on the relevant material when it's running low.
So it'd go something a little like this:
turtle.suck doesn't seem to care what sort of block it collects, and just goes for the first in the inventory. I could just have the turtle carry 3 ender chests for the 3 different block ids (using chickenbones' ender storage mod), but if it's possible to have it done through just 1 ender chest that'd be my prefered option.
I'm willing to install peripheral mods if needed to make this program work. Currently have Computercraft + MiscPeripherals installed.
For the building, I have slot 1 with fuel, slot 2 with floor material, slot 3 with wall material, and slot 4 with glass. I want to have slot 5 be an ender chest which has more of the relevant material in it, and for the turtle to automatically restock on the relevant material when it's running low.
So it'd go something a little like this:
turtle.dig
turtle.select(3) -- select 3rd inventory space [wall block]
if turtle.getItemCount(3)==1 then
turtle.select(5)-- select slot with ender chest in
turtle.place()
turtle.getBlock(3,63) -- not correct code afaik, but I want to suck up 63 of the same id block as is currently in slot 3
turtle.dig() -- pick up ender chest again, due to something being in slot 1,2,3,4 ender chest will default back to slot 5
end
turtle.select(3) -- reselect slot 3, which is the block we want to place
turtle.place() -- restocked and placing blocks again!
turtle.suck doesn't seem to care what sort of block it collects, and just goes for the first in the inventory. I could just have the turtle carry 3 ender chests for the 3 different block ids (using chickenbones' ender storage mod), but if it's possible to have it done through just 1 ender chest that'd be my prefered option.
I'm willing to install peripheral mods if needed to make this program work. Currently have Computercraft + MiscPeripherals installed.