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

Could i get some help?

Started by Harry_Turney123, 06 October 2012 - 06:12 PM
Harry_Turney123 #1
Posted 06 October 2012 - 08:12 PM
Hello im a newb at CC but i made a mining turtle quarry its not 100% but i need help finishing it. What i would like help with is some code that will stop it a certain layer because im clue less with doing that also i would like some code that will see when its inv is full and put a ender chest above it put its loot in then break the chest and keep on going. I will be very great full if anyone would help me. Thank you. :D/>/>
Sebra #2
Posted 06 October 2012 - 08:29 PM
Stop when turtle unable to dig detected block. This means bedrock.
Inventory full condition is when turtle has no empty slots. You can check it after each successful dig and suck.
Good luck!
jag #3
Posted 06 October 2012 - 09:27 PM
You could do this each time he mines
-- 'selection' = current slot
-- slot 16 is where the enderchest is

function checkInvSpace()
  for i = 1,15 do
	if turtle.getItemSpace(i) > 0 then
	  turtle.select(i)
	  return true
	end
  end
  if turtle.getItemSpace < 1 then
	return false
  end
end

if turtle.getItemSpace(selection) < 1 then
  if not checkInvSpace() then
	turtle.select(16)
	turtle.placeUp()
	for j = 1,15 do
	  turtle.select(j)
	  turtle.dropUp()
	end
	turtle.select(16)
	turtle.digUp()
	turtle.select(1)
  end
end
Got it on pastebin: wFMjqMLN
Harry_Turney123 #4
Posted 07 October 2012 - 12:41 AM
Thanks my friend was able to get it to stop when it was fished :D/>/>