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

Help with droppof when full and item detection

Started by Snowz, 15 August 2012 - 08:22 AM
Snowz #1
Posted 15 August 2012 - 10:22 AM
I am trying to create a mining turtle code, that mines in set coordinates, then returns to home. I want it to check for items that it cannot pick up(say its inventory is full off cobblestone, but it wants to mine some dirt) it will set temporary coords, then return home, wait until its inventory has been completely emptied, then go back to the temp coords, then continue mining. I dont know how to bring it back when it is full, or how to keep it in place while it gets emptied(outside influence: manual or tekkit pipes).
This is basically what i want (The UI of this and the digging style/return co-ord style of this) and a LOT of help with waiting while the invetory gets emptied. and not mining until the next brick to be mined can be put in the inventory.

Please help, Complete noob.

P.s. will post attempted code tommorrow, but feel free to start a new better one for me.
Noodle #2
Posted 15 August 2012 - 02:32 PM
Few Tips: GPS api can be useful.. There is already a program of a mining turtle its called excavate.
Lettuce #3
Posted 15 August 2012 - 07:07 PM
Well, that depends on the program. If you can't use GPS, say, you don't know whether or not it will travel out of those limits, then I have a question already posted on these forums, in the same section, asking about how to set a drop zone. I decided to use variables. That was yesterday. I was coding for hours, and I'm still on the debug stage. I wanted that turtle to center itself, and move in a straight line, then return.
If it is at all possible for your program, especially if this is one of your first ones, I advise using GPS, or starting simpler.
Snowz #4
Posted 16 August 2012 - 04:11 AM
Thanks for the help guys, but i wrote this in a tired state last night, wht i meant to ask was supposed to be only about detecting when it is full(cant pick up more) going home(which it already daoes thanks to rodlon), and waiting til it is completely emptied before returning, Sorry for the unclear message, like i said, tired.

—EDIT—

Ok Scratch that, how about just some help with wating until the chest is emptied

Spoiler

function descarga()
				-- Drops everithing but 1 block
				print("Dropping items...")
				local tmp2=9
				while tmp2 > 0 do
  turtle.select(tmp2)
				if turtle.getItemCount(tmp2) > 0 then
							   turtle.drop(turtle.getItemCount(tmp2)-1)
								end
								tmp2=tmp2-1
				end
end

the turtle.drop is what i need to change to "wait until empty"

—-EDIT EDIT—
Man this thing gets more complicated the more i read it
Snowz #5
Posted 16 August 2012 - 05:51 AM
Ok, this will have to do with obsidian pipes for now:
Spoiler

function descarga()
			    -- Drops everithing
			    print("Dropping items...")
			    local tmp2=9
			    while tmp2 > 0 do
  turtle.select(tmp2)
			    if turtle.getItemCount(tmp2) > 0 then
							    turtle.drop(turtle.getItemCount(tmp2))
							    end
							    tmp2=tmp2-1
			    end
end
Would that worK? Just dumping eveything the old way? BTW I would still like to wait til it is emptied