Jump to content




Mining Turtle to dump cobble, dirt?


12 replies to this topic

#1 allbad

  • Members
  • 11 posts

Posted 04 May 2012 - 02:29 AM

How do I get the mining turtle to dump the junk I don't want like cobblestone and dirt? I know to fill the 9 slots with a single of what I want, but I'd rather do some kind of turtle.detectItemInSlot(<num>) and if it's on a dump list it drops it.

#2 AnrDaemon

  • Members
  • 12 posts

Posted 04 May 2012 - 03:32 AM

Unfortunately, it's not possible... and not going to be possible. Turtles are supposed to be blind, hand-less golems that can only move around and bash things mindlessly.

#3 Luanub

    Lua Nub

  • Members
  • 1,135 posts
  • LocationPortland OR

Posted 04 May 2012 - 04:30 AM

You could do this, just would need to setup a couple of blocks to run turtle.compare() against then turtle.drop() if its true.

#4 libraryaddict

  • New Members
  • 195 posts

Posted 04 May 2012 - 05:09 AM

The best way to do this I think is to have a slot thats purely for cobble etc.
Slot in this case is 1.
turtle.select(1)
if turtle.compare(1) and turtle.getItemCount(1) > 63 then
  turtle.drop()
end
turtle.dig()

This will drop the blocks there if its full and mine the new block.
Meaning this should work just fine for making sure cobble will never take over one slot.
You could also just have some code to dump the "trash" if your inv is full.

#5 allbad

  • Members
  • 11 posts

Posted 04 May 2012 - 01:36 PM

libraryaddict, that's it! When I go mining, a good 80% of what's collected is cobble. Just by taking up 1 slot in the turtle I'm probably freeing up 5 others that'll be taken over. You are a genius.

#6 allbad

  • Members
  • 11 posts

Posted 04 May 2012 - 01:48 PM

oh wait... I'm comparing a stone block in front of me to a cobble block in slot 1. That's not gonna work.

#7 libraryaddict

  • New Members
  • 195 posts

Posted 04 May 2012 - 02:03 PM

Good point.

Hmm.

Maybe just have 2 slots for stone/cobble?

if turtle slot 2 is full. drop it.
If turtle slot 2 is full but not cobble.
then drop slot one.

With it remembering if its cobble or not in there.

#8 allbad

  • Members
  • 11 posts

Posted 04 May 2012 - 11:54 PM

well, poo... my server (bukkit) is sufferring from this bug:

turtle.compare() always returns true
http://www.computerc...s-returns-true/

Guess I'll have to put this one on the backburner.

Thanks for the ideas libraryaddict, it works in vanilla.

#9 Concerned Citizen

  • New Members
  • 2 posts

Posted 02 September 2013 - 06:18 PM

Read my post below.

#10 Concerned Citizen

  • New Members
  • 2 posts

Posted 02 September 2013 - 06:33 PM

View PostConcerned Citizen, on 02 September 2013 - 06:18 PM, said:

Hey guys try this: (Set slot 1 to stone, slot 2 to cobblestone, and slot 3 to dirt)

turtle.select(1)
if turtle.compare(1) and turtle.getItemCount(2) > 63 then
turtle.select(2)
turtle.drop()
end

turtle.select(3)
if turtle.compare(3) and turtle.getItemCount(3) > 63 then
turtle.drop()
end

Hopefully that works!

Actually, you might want to make dirt slot 1, stone slot 2, and cobble slot 3 like this: (because then dirt becomes the placedown block for when it comes back up)

turtle.select(2)
if turtle.compare(2) and turtle.getItemCount(3) > 63 then
turtle.select(3)
turtle.drop()
end

turtle.select(1)
if turtle.compare(1) and turtle.getItemCount(1) > 63 then
turtle.drop()
end

#11 Zudo

  • Members
  • 800 posts
  • LocationUK

Posted 03 September 2013 - 02:22 AM

View PostConcerned Citizen, on 02 September 2013 - 06:18 PM, said:

Read my post below.

The mad necros :)

#12 kreezxil

  • Members
  • 128 posts
  • LocationBowie, TX

Posted 03 September 2013 - 09:34 AM

View Postallbad, on 04 May 2012 - 01:48 PM, said:

oh wait... I'm comparing a stone block in front of me to a cobble block in slot 1. That's not gonna work.

You can cook cobble in a basic furnace to get your stone block that you can use for comparison.

#13 floppyjack

  • Members
  • 18 posts

Posted 03 September 2013 - 02:20 PM

You actually don't need to compare anything. If you select slot 1, the items will always be put into the first slot that they can go into, just like shift-clicking the item in the turtle's inventory. Before or after digging, you just check if the junk-slots are close to full and drop all the items but one per junk-slot:
turtle.select(1)
turtle.dig()
for slot = 1, 4 do -- junk-slots are slots 1 through 4
  if turtle.getItemSpace(slot) < 5 then
	turtle.select(slot)
	turtle.drop(turtle.getItemCount(slot) - 1)
  end
end
I hope this helps.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users