Just another turtle mining program

Nyan

New Member
Jul 29, 2019
18
0
0
So I made this turtle program and thought it could be useful to someone else. It's very simple, and the main idea behind it was to make something that doesn't require any maintenance. This program is based on another one and basically is a major simplification of the source program.

Preamble
In a couple of my previous worlds I generally relied on frame quarries for mining, but I didn't like them too much because they are rather complex, hard to set up, require maintenance and – the worst of all – due to slow frame motors they can mess up their positioning if a server restarts while they are moving (unless you use gps, which makes the system even more complex). Since I play SSP, I turn the game on and off pretty frequently, and I also get occasional server failures and freezes. So I was looking for a way to automate mining that would be relatively fast, simple and as resistant to bugs and server restarts as possible.
Most turtle mining programs I saw either use very complex logic or gps. I wanted to avoid using gps towers since their range is limited, and using complex moving patterns without gps can result in mispositioning. My solution to this problem is a very simple program with basic logic.

Usage

  1. You'll need a mining turtle with a chunk loader upgrade.
  2. Place an ender chest in the 1st slot. It will be used to purge all the mined items.
  3. Place another chest in the 2nd slot. Supply it with fuel, turtle will grab a stack when it needs to refuel.
  4. Run the program with 2 arguments:
  • First you set the max height (Y coordinate). Turtle will mine everything from this level to level Y1 (bedrock) and continue forward.
  • Second argument is how far you want it to mine (it moves in a straight line).
  • You can optionally add a 3rd argument (any text will do) to activate the return function.
Features

  • Strip-mining: you can tear down huge masses of land)
  • Gentle mining: many people don't like world holes left by strip-mining, so you can send your turtles to the lower levels, and the upper levels will remain completely intact.
  • Easily scalable: even a couple of turtles will provide a nice amount of ores at a decent speed, but if you need more you can simply add more turtles.
  • State saving: the turtle remembers its progress and continues after you start the game again.
  • Fail proof: a very simple logic is used to ensure the turtle is always positioned correctly. No matter what happens to your server, the turtles should be just fine.
  • Return function: make your turtle go back to the starting point.
Usage example
Suppose we stand at Y level 80. We grab 5 turtles and run them with a command dig 60 1024. They will mine straight down, rise to Y60 and continue 1024 times. Since the main idea of the program is reliability, it should be OK to use even larger numbers. As a result we get a chunk of 5x1024 blocks mined out from level Y1 to Y 60, leaving nice 20 blocks under the surface. Note that turtles won't handle lighting, so I suggest placing a couple of water blocks to avoid making a monster zoo under your base.

As you can see, this is a very basic program and I'm sure many people use something similar in their worlds. Hopefully it will be of any use to those who don't like programming.

Download
http://pastebin.com/c5Q0Pien
pastebin get c5Q0Pien dig

Changelog
1.3.2 - Bugfix: now properly handling mobs when moving down; extra protection for refueling procedure
1.3.1 - Bugfix: crash during refuel at startup
1.3 - Return function added
1.2 - Initial release
 

RedMinecraft

New Member
Jul 29, 2019
2
0
0
Hello man! I wrote down your program to a minig turtle with a chunk loador module on. I called the file quarry where the script is. I am a noob to computercraft so i am probably doing something simple wrong. i didnt take the titles over each of the functions in the turtle. First of did i try to just type quarry to run it, but than "bios:338: [sting "quarry"]:111: ')' expected" came up. THis was not in lua or tomething. Just the normal startup place. than did i try "dig 60 1024" but than it just came "No such program".
pleace help me! I really whant this program! I am running TurtleOS 1.5 by the way.
Your awesome!!
 

nickRepublic

New Member
Jul 29, 2019
21
0
0
Haven't tried it but this sounds pretty pretty...pretty good!

I modified the excavate to simple place an enderchest and dump, but this seems much more sophisticated.[DOUBLEPOST=1366727276][/DOUBLEPOST]
Hello man! I wrote down your program to a minig turtle with a chunk loador module on. I called the file quarry where the script is. I am a noob to computercraft so i am probably doing something simple wrong. i didnt take the titles over each of the functions in the turtle. First of did i try to just type quarry to run it, but than "bios:338: [sting "quarry"]:111: ')' expected" came up. THis was not in lua or tomething. Just the normal startup place. than did i try "dig 60 1024" but than it just came "No such program".
pleace help me! I really whant this program! I am running TurtleOS 1.5 by the way.
Your awesome!!

Just type pastebin get xKWZBSPg quarry to get the program. You don't need to type it out yourself.
 
  • Like
Reactions: RedMinecraft

DaringEnchilada

New Member
Jul 29, 2019
3
0
0
Hey, this is an amazing turtle script. It's easy to use, very simplistic, incredibly practical, and thus far extremely reliable. Even though I enjoy programming in python, I don't feel like learning LUA no matter how similar just to make a turtle script, nor do I have the time, so I found this script to be amazingly helpful.

Somethings I noticed you may need to fix:
At line 151...
  1. print('Chunks left to mine: '..x)
  2. digDown()
  3. print('Hit bedrock, moving up '..y..' blocks
It's not Chunks left to mine, it's blocks. I was frightened at first for I though I sent my turtle off over 1,024 chunks.

The turtles don't return after they've been sent off, so you have to go down and retrieve them manually which can be annoying when there's lava and water in the tunnel. Adding a return function simply by saving the very initial coordinates would be very convenient.

That's all I can think of at the moment, other than that it's a really brilliant little script, and being able to call it with "pastebin get xKWZBSPg dig" is amazingly convenient.
 

Nyan

New Member
Jul 29, 2019
18
0
0
Thanks) I'm glad it's useful for someone other than me)

Hey, this is an amazing turtle script. It's easy to use, very simplistic, incredibly practical, and thus far extremely reliable. Even though I enjoy programming in python, I don't feel like learning LUA no matter how similar just to make a turtle script, nor do I have the time, so I found this script to be amazingly helpful.

Somethings I noticed you may need to fix:
At line 151...
  1. print('Chunks left to mine: '..x)
  2. digDown()
  3. print('Hit bedrock, moving up '..y..' blocks
It's not Chunks left to mine, it's blocks. I was frightened at first for I though I sent my turtle off over 1,024 chunks.


The turtles don't return after they've been sent off, so you have to go down and retrieve them manually which can be annoying when there's lava and water in the tunnel. Adding a return function simply by saving the very initial coordinates would be very convenient.

That's all I can think of at the moment, other than that it's a really brilliant little script, and being able to call it with "pastebin get xKWZBSPg dig" is amazingly convenient.

Return feature shouldn't be very hard to implement, but it will require writing a more intelligent state saving mechanism, which I'm rather reluctant to do. I'll see what can be done about it. Originally I wanted to make a rednet remote control, but rednet has a range limit, so I opted for maximum simplicity. Unfortunately, I don't have much time for games and programming ATM, but I'll keep that in mind.
 

Hoff

Tech Support
Oct 30, 2012
2,901
1,502
218
The only problem I've found with this is that when they reach the top and attempt to place a chest if gravel so happens to fall after their mining check they become stuck indefinitely.Fairly simple fix you just don't have a turtle.digUp() after the turtle.attackUp() in the drop off to the first ender chest.


Otherwise tremendous script! I commend you on it.
 

Nyan

New Member
Jul 29, 2019
18
0
0
Just added a few updates. Implemented the return option. Enable it by writing anything as a 3rd argument. Example: dig 50 50 return. This feature is not protected by the state saving mechanism, so if the server restarts while the turtle is going back, it will get stuck and you'll have to retrieve it manually.

The only problem I've found with this is that when they reach the top and attempt to place a chest if gravel so happens to fall after their mining check they become stuck indefinitely.Fairly simple fix you just don't have a turtle.digUp() after the turtle.attackUp() in the drop off to the first ender chest.
I changed the code, though it's odd you had this issue at all. I tested the program extensively with gravel and never had any problems. Anyway, it should be fine now.
 
  • Like
Reactions: Hoff

Hoff

Tech Support
Oct 30, 2012
2,901
1,502
218
Yeah at first I thought it was a fluke but it kept happening so I went through it to check it out.
 

Jakeb

New Member
Jul 29, 2019
309
0
0
So far it has been working great for me. Just a suggestion, but maybe you could add automatic voiding of junk stuff (cobble, dirt, gravel, etc.) with a void chest from railcraft or a trash can from extra utilities?
 

Bihlbo

New Member
Jul 29, 2019
127
0
0
So far it has been working great for me. Just a suggestion, but maybe you could add automatic voiding of junk stuff (cobble, dirt, gravel, etc.) with a void chest from railcraft or a trash can from extra utilities?
Why wouldn't you set up something that voids the chosen blocks from the ender chest instead?
 

Jakeb

New Member
Jul 29, 2019
309
0
0
Why wouldn't you set up something that voids the chosen blocks from the ender chest instead?

I'm not sure my really basic sorting system from extra utilities could keep up with 2-3 turtles along with all the junk blocks.
 

Boes

New Member
Jul 29, 2019
14
0
0
A sorting system from the ender chest would most likely be easier to implement... redpower tubes with a filter to pull what you want trashed, just have the filter pointing to a block of lava... and the trash item is gone.. another way would be with a diamond pipe pulling the items you want trashed also dumped into either void chest or lava block.
 

Nyan

New Member
Jul 29, 2019
18
0
0
So far it has been working great for me. Just a suggestion, but maybe you could add automatic voiding of junk stuff (cobble, dirt, gravel, etc.) with a void chest from railcraft or a trash can from extra utilities?

It's not impossible, but it will make the program overly complex. I'd like to keep the program as simple (and therefore reliable) as possible, and since sorting can easily be done on the receiving end, adding this functionality doesn't seem to be worth it. I can suggest improving your sorting system (LP so far is the most efficient choice, but AE should do the trick, too) or checking out the programs here, some of them have the feature you require.
 

Jakeb

New Member
Jul 29, 2019
309
0
0
It's not impossible, but it will make the program overly complex. I'd like to keep the program as simple (and therefore reliable) as possible, and since sorting can easily be done on the receiving end, adding this functionality doesn't seem to be worth it. I can suggest improving your sorting system (LP so far is the most efficient choice, but AE should do the trick, too) or checking out the programs here, some of them have the feature you require.
I was hoping to avoid building a full sorting system this early in the game... oh well, thanks anyways.
 

Nyan

New Member
Jul 29, 2019
18
0
0
I'm not sure my really basic sorting system from extra utilities could keep up with 2-3 turtles along with all the junk blocks.
I believe a wooden pipe and a stirling engine would be able to handle a couple of turtles. Add a diamond pipe and you're all set)
 

Jakeb

New Member
Jul 29, 2019
309
0
0
I believe a wooden pipe and a stirling engine would be able to handle a couple of turtles. Add a diamond pipe and you're all set)

I completely forgot about the stirling engine... I did end up adding a few more transfer nodes and building a deep storage unit for the cobble and now its keeping up with the turtles. Thanks for this great little mining program.
 

Harvest88

New Member
Jul 29, 2019
1,365
-1
0
Okay I'm going to give this a shot cause I need a ton and half of stupid lead for all those liquiducts I'll need for 600+ coke ovens.. I just wished my server got someone to help me with that though. All I changed on the server was condensed blocks is added and got a few plugins.