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

Commanding Turtle to Mine Certain Blocks

Started by Maccyjam, 21 March 2012 - 07:50 PM
Maccyjam #1
Posted 21 March 2012 - 08:50 PM
Hey,
I was wondering if I could program a mining turtle to mine specific blocks in a radius.
I've only just got this mod today and I'm already in love with it, however I couldn't find anywhere anything that said about mining specific blocks.
Any help will be greatly appreciated.
Thanks in advance,
Liraal #2
Posted 21 March 2012 - 08:53 PM
define 'specific blocks' (basically, what do you mean by 'specific') so that we can help you

anyway, you scored a point in my eyes for a clean post structure with proper punctuation and spelling. :(/>/>
Maccyjam #3
Posted 21 March 2012 - 09:01 PM
Why thank you! :(/>/>
I want to command it to mine only stone in a certain radius while just bypassing all of the other dirt, gravel and whatnot.
Liraal #4
Posted 21 March 2012 - 09:11 PM
this is both simple and not really so.

for simply knowing what is ahead, supply one slot with a block of stone(not cobble, but smoothstone) and use:

turtle.select(slot)
turtle.compare()

the problem is what to do if encountered something different from stone. simplest method is to drop it to the ground.
more advanced is to mine it, go through, and place it back. The hardest is to find a path around.

Which of these would interest you?
Maccyjam #5
Posted 21 March 2012 - 09:14 PM
I guess the mine it, and place it back would probably be the best however I am just starting out so I might start with the method of dropping it to the ground.
etopsirhc #6
Posted 22 March 2012 - 04:31 PM
i gotta ask , is there a simple way to compare items in the inventory?
Liraal #7
Posted 22 March 2012 - 04:50 PM
unfortunately not, unless you keep track of what goes where.
PatriotBob #8
Posted 23 March 2012 - 09:24 PM
That's one of the main annoyances of turtles right now is their limited ability to determine material type. Compare works but is limited to 9 types and then can't collect anything. You could do something advanced like 2 or more turtles that communicate over wireless one group which scans materials and the other that mines it. But that gets… fun. :(/>/>

I would even take if the CC mod allowed us to scan the block and it returned something nondescript but unique like a crypt hash of the block id and turtle id. Something where we have no idea what it actually is but can distinguish materials. We'd still be limited to 9 materials we can accurately identify, but at least we'd be able to have an idea of material composition out side of that 9.
rowas #9
Posted 01 July 2014 - 02:50 AM
I'm just wondering if there has been any recent developments on this topic. Currently, I'm doing all the research as I layout the foundations for a new program.
I need to know whether there is a way for turtles to determine what blocks ARE by their ids rather than the program writer having to use turtle.compare() and guesswork.
If not, I guess it won't be the end of the world, but I would highly suggest implementing this in the next release. I'm sure it would save a lot of time for many people and make turtles a little "smarter".
Lyqyd #10
Posted 01 July 2014 - 03:24 PM
It's almost certainly never going to be part of ComputerCraft itself. OpenPeripheral has a peripheral you can add to examine the turtle's inventory. You could have picked a much newer topic to bump, as this sort of thing comes up frequently.
Bomb Bloke #11
Posted 01 July 2014 - 03:36 PM
Specifically, it's a design choice, not a technical limitation.
rowas #12
Posted 01 July 2014 - 08:51 PM
It's almost certainly never going to be part of ComputerCraft itself. OpenPeripheral has a peripheral you can add to examine the turtle's inventory. You could have picked a much newer topic to bump, as this sort of thing comes up frequently.

Apologies for that. I noticed when I was browsing this section today. If this question comes up regularly, I suggest adding it to a pinned topic as I am sure you would grow weary of answering the same questions regularly. That said, thank you for letting me know about the inventory auditing peripheral. I think that will work just fine for my scenario.

Specifically, it's a design choice, not a technical limitation.

That sounds fair considering how "powerful" an extension like that would make turtles. With something like that, turtles could easily be programmed to use "Hive mining" methods to quicky access and single out specific resources which would quickly erode the fun for many programmers. But if someone developed a mod that simply allows the turtle to output block ids, that would make lives easier.