Just another turtle mining program

Hoff

Tech Support
Oct 30, 2012
2,901
1,502
218
With the arguments, how would I set it up to mine a 64x64 area? Would I do: Dig 64 64?
That's not how this program works. It digs a straight line. For example;

dig 64 64

Would make the turtle dig down to bedrock and back up to y level 64, 64 times moving forward each time of course.
 

taco412

New Member
Jul 29, 2019
2
0
0
this looks cool. 2 questions. One are you supossed to put 2 ender chests in or one? and 2. have you thought about making a short tutorial of it?
 

Nyan

New Member
Jul 29, 2019
18
0
0
this looks cool. 2 questions. One are you supossed to put 2 ender chests in or one? and 2. have you thought about making a short tutorial of it?
1. Two. Output and fuel supply.
2. I suppose I could if it's really necessary, but I thought it's a little too simple to require a full-blown tutorial)
 

taco412

New Member
Jul 29, 2019
2
0
0
yah you are right, i figured it out and is very simple. I use this on a multiplayer server and it works great for a couple hundred blocks but then it will stop at the max y setting and stay there still on. if a block is placed in front of it it will still mine it but it is stuck... any ideas?
 

Hoff

Tech Support
Oct 30, 2012
2,901
1,502
218
yah you are right, i figured it out and is very simple. I use this on a multiplayer server and it works great for a couple hundred blocks but then it will stop at the max y setting and stay there still on. if a block is placed in front of it it will still mine it but it is stuck... any ideas?
Are you making sure you're using chunk loader turtles?
 

Nyan

New Member
Jul 29, 2019
18
0
0
a min Y value would be nice aswell
Can't do that, unfortunately. It's either this or reliability, and I'd totally choose the latter. The program uses the zero level as a marker to determine its exact position. The counter basically resets every time the turtle gets to bedrock - this way you can be sure that even if something goes terribly wrong, the program will fix itself in the next iteration. If I use a user-defined zero level, the only way to determine the turtle's position will be counting, which is terrible (not to mention gps, which is worse due to its range limit).

The main problem I had with most other mining scripts is that they often use counting and they just keep losing count all the time due to restarts and glitches. It's not a big issue if you mine a 10x10 square, but if you go for larger areas, mispositioning becomes a major annoyance. Especially if your turtle goes in a completely wrong direction after a while))

P.S. Just curious: how would you use this feature, anyway? Tunnel making? I'm pretty sure there are many programs for that.
 

iMontouch

New Member
Jul 29, 2019
147
0
0
hey! :)
first of all: very nice script. We are using this to dig with 150 turtles simultaniously and its hillarious. Respect!

But here and there we are running into the same error (normaly after a reboot). The turtle only shows:
dig:44: attempt to compare __le on nil and number
Do you have an idea to fix that?

+ im not sure. Are the turtles working after a reboot? And if not, is this possible? (automaticaly)

thanks!
 

Nyan

New Member
Jul 29, 2019
18
0
0
hey! :)
first of all: very nice script. We are using this to dig with 150 turtles simultaniously and its hillarious. Respect!

But here and there we are running into the same error (normaly after a reboot). The turtle only shows:

Do you have an idea to fix that?

+ im not sure. Are the turtles working after a reboot? And if not, is this possible? (automaticaly)

thanks!

Now that's what I call stress testing)) Turns out there was a little bug I missed, check out the updated version. What was happening: I forgot to assign a value to the startup refueling procedure, so your turtles were getting this error each time the server rebooted while they were refueling. Since turtles don't refuel very often (and it doesn't take much time), having these two events overlap is a rather rare occasion - that's why it remained unnoticed for all this time.

Concerning restarts: generally, the turtles are supposed to write their state to a file so they can keep working after rebooting. However, if your server crashes, the turtles may freeze. I don't know why that happens, but simply restarting the server again (properly this time) or rebooting the turtles manually should bring them back to work.
 
  • Like
Reactions: iMontouch

Nyan

New Member
Jul 29, 2019
18
0
0
I've seen that before, and I'm totally puzzled. This bug seems to be very difficult to reproduce, because every single time I restart a turtle with Ctrl+R, it works just fine. The bug only manifests after server restarts. I did some more debugging and according to my research a turtle just freezes when executing line 135, which is turtle.digDown(). This command is a part of CC and I have absolutely no idea what can possibly prevent if from running. I don't think there's anything I can do about it. I'll keep an eye on that, but for now I blame minecraft/CC.

--added--

In fact, I can't reproduce it at all now, no matter what I do. Does it happen after a normal restart on your server or only after crashes? How often does it happen? The only thing I can suggest now is adding a new line
Code:
236 end
237 os.sleep(1)
238 loop()
It'll hardly do anything, but it's the best idea I have...
 

iMontouch

New Member
Jul 29, 2019
147
0
0
no crashes on our server so far.. :D

i will try that.
For now we have enough materials to just send 200 turtles a day to mine and do their job, so that some loss isnt even notable.

offtopic:
Any idea on how a turtle can send a command (like the pastebin get cmd) to a turtle next to her besides rednet? We want a turtle to start all the turtles :D
 

Nyan

New Member
Jul 29, 2019
18
0
0
Oh yeah, I've been trying to find a nice way to implement a control unit for quite a while. No simple solution comes to mind.

  • I don't know much about turtles programming turtles, but I do know for certain that you can use floppy disks to flash turtles with a startup program. Can't find any sample code for that ATM. It seems that the thing you're looking for is usually referred to as 'self-replicating turtles' and 'swarm control'.
  • Alternatively, you could use a wrapper script running in a loop on all turtles. For instance, something that waits for redstone signal, when it gets one, it rewrites the startup and runs the mining program.
  • A creative idea: use fuel chest as a transport for information. Get a turtle constantly check for fuel. While the chest is empty, it idles. When you put something in, it writes the startup code and starts working.
  • Rednet... If turtles are close to each other it would be the easiest way. Will require a modem or a chunk loader on every turtle, though.
As for the proper control, the best idea I had so far is to use wireless redstone. It doesn't have a range limit and even works across dimensions, which is awesome. Commands then could be encoded into binary form and transmitted to the turtles as a sequence of ones and zeros. Sounds pretty cool, right? I suppose I could even implement a basic two-way connection and get a big screen displaying swarm status. There's just one problem: RP2 is late (as always) and Chickenbones' wireless redstone depends on it.

Another idea: use rednet relays/repeaters. Get a telecoms turtle traveling behind the swarm at max height and leaving a relay every now and then so that our main stationary control unit can reach the swarm regardless of distance. It will need a chunk loader for every relay, however, so you'll get even more of them always staying loaded.
This will require a fair amount of work, so I can't say when I'll get down to coding this. I'd appreciate any advice on this matter.
 

iMontouch

New Member
Jul 29, 2019
147
0
0
i wrote a little turtle script which digs a tunnel of 3 blocks width and 2 high.
It places a turtle and a disk drive next to it. Then it loads the drive with an initial startup disk. After that it boots the turtle and destroys the drive to do the procedure for the next turtle.
I am testing this imo.
 

iMontouch

New Member
Jul 29, 2019
147
0
0
hey. Its me again. My setup turtle is working very well now.

But my problem (Blocks left to mine: xxxxx) is still occuring. We installed 200 turtles and after 5-6 hours (no restart, no crash in between) 40% of them are showing this message.
10% of them had this message immediatly after starting them (dig 120 5000 return) --> Stuck at Blocks left to mine: xxxxx

Any suggestions or ideas on how to fix that? sure, we can simply install more turtles. But a nearly 100% success rate would be nice, you know?

anyways: awesome script! Keep up the good work!

edit:
The turtles with the problem are loading the coal from the CoalChest in the 2nd slot and the enderchest in the 3rd. As soon as I switch them (coal and CoalChest) the turtle will go down 1 block to then produce the same error again.
 

Nyan

New Member
Jul 29, 2019
18
0
0
40% is a lot =(
I don't know if this is it, but that sounds like a refueling issue. Any chance you got non-fuel items in the fuel chest? Or was the turtle's bottom right slot occupied?
Try this version - http://pastebin.com/c5Q0Pien
I'm not putting it in the first post just yet because I'm not quite sure if that was the problem. Please let me know if it worked or not.

P.S. 200 turtles sounds pretty crazy) I'd really love to see some screenshots of that awesomeness! Do you stream by any chance?
 

iMontouch

New Member
Jul 29, 2019
147
0
0
The Fuel Chests do always contain coal.
Yep, thats the source: The bottom right slot is indeed occupied. Sorry, overseen that :p

I will try your version for 20 turtles and report asap.

Some screenshots:
The spot we currently mine on:
0715562151d9738519c36.png

0715592451d9743cd1e35.png

This is the spot where we were weeks before (pretty good place for some nuclear reactors :p )
0716000951d9746974c4f.png

0716020951d974e102912.png
nope, currently no streaming activity. We were making lets plays in the beginning, but it was impossible to handle my incompetence of the game during a lp session. :D
 

iMontouch

New Member
Jul 29, 2019
147
0
0
not a single turtle of the improved code showed this error or got stuck. yet.

so i think you could say this problem is fixed. I will report further errors, if any.

I was sending out about 500 turtles. Not a single turtle got stuck atm. But maybe thats because we ran out of fuel.
We have too much serverlag atm (weak server) so we cant simply setup more Wither skeleton spawners to cover this.
As soons as this is fixed I can give you a detailed report + Video if you like to.