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

[1.5] Simple mining turtle program

Started by MrXperia, 12 April 2013 - 02:31 AM
MrXperia #1
Posted 12 April 2013 - 04:31 AM
Hi there!

I'm new to this forum and to the computercraft mod and I've been trying to learn more about it, watching tutorials. The problem is that most of the videos and tutorials I watch use CC 1.3, so they don't need to refuel their turtles.

So I'm writing this help topic for you to help me to program a simple mining turtle program. I'm a complete noob, so I'd love all the help as I can get.

I "just" want to program my turtles to dig a 3x3 tunnel, refuel themselves, because when I create a program withe the line "turtle.refuel()", I have to specify the amount of fuel I want it to use, and that's not practical whatsoever.

I'd like my turtles to unload in a chest when they're full and to come back to the starting position when they finish the work.

Thank you.
Noiro #2
Posted 12 April 2013 - 06:57 AM
Why is it not practical to specify how much fuel? What part do you need help with exactly? Can we see some example code for what you have tried?
MrXperia #3
Posted 12 April 2013 - 07:22 AM
I've tried simple codes because I am still learning. I don't know how to program it to return to the starting point and to unload collected stuff to a chest. It is not practical because, for example: I want to make a 100 block long tunnel, 3x3; how can I know the amount of fuel (coal, for example) the turtle is going to spend in the journey? This assuming that it makes its return to the starting point and unloads all the stuff when full.

It's also not practical, because when i set the amount of coal I want the turtle to use, it consumes it instantly. For example: I load my turtle with a stack of coa. I program a script saying that I want it to move 3 blocks forward, but the moment i execute the program, the coal disappears. So, what I'd like to do is to be able to refuel a turtle with a stack of coal, but the turtle should only spend the amount of coal required for the journey. Did I make it clear? If not, I can try to explain it better.

So, at this point, my biggest problem is the refuel one…

Thanks for all the help.
MrXperia #4
Posted 12 April 2013 - 08:22 AM
Well, I just found the perfect program for me here: http://www.computercraft.info/forums2/index.php?/topic/8340-3x3-tunnel-with-options/page__st__20

I'll take some ideas from here and start programming. Thank you very much for all the help.
Noiro #5
Posted 12 April 2013 - 10:23 AM
Just remember that if you label the turtle, him consuming more coal than needed should be perfectly fine. I suppose if you implemented him to count every 16 movements, he would consume one coal from his "coal slot", that would work. Realistically, I'd more likely just make a program to figure out how much coal he'd need for the journey, then before running, he'd calculate how much he had in comparison with how much he should have and throw an error if it is not enough. Chances are, he won't find enough coal to make up for it on the way.

And once you have a turtle charging station and a good power source, it doesn't matter anyway. ;)/>