This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
NaughtyGinger's profile picture

Place chest if full

Started by NaughtyGinger, 09 September 2013 - 10:59 AM
NaughtyGinger #1
Posted 09 September 2013 - 12:59 PM
Title: Place chest if full

Hey Guys,

I recently startet programming Mining Turtles to do Strip Mining for me.
This was what i created: http://pastebin.com/cHuccnQB
It actually works quite good but if the inventory of the turtle is full, the turtle won't get them and it also won't go back to a chest which i placed next to the point where i placed the turtle. So can anyone help me with a few lines which i can add to the code so that the turtle simply places a chest if the inventory is full and drops all stuff in it?

Thanks
NaughtyGinger
gronkdamage #2
Posted 10 September 2013 - 06:33 AM
Looking quickly over your code (I really need to go to bed :)/> ) - I don't see a 'turtle.getItemCount(x)' - which you'd need to tell your turtle is full.

Basically here's what you need to do: (without writing a program)

keep track of the X, Y, and Z of the turtle (forward, left or right, up or down) as it moves.
after digging, if slot 16 has anything - return to start (go back -x, -y, -z) - drop the stuff into the chest - then return where it was (x, y, z) and continue on.

Take a look at this: http://pastebin.com/UHbwRh33

This is my big mining program. It doesn't do anything fancy; but you can see how I keep track of my inventory - and when full, return to start - move ore around (refill) and then unload the turtle - and finally return to where it last was.

Hope that helps.