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

Rebootable rabbit hole mining program

Started by eonsv, 27 December 2012 - 10:18 PM
eonsv #1
Posted 27 December 2012 - 11:18 PM
Hello,

I've had a lot of problems with unstable servers, and people complaining about my quarry world holes, made by my strip-mining turtles. Therefore I've made a program which handles these problems. It basically digs vertical mine-shafts and checks the walls for ores. It probably isn't the most time efficient way to do a quarry, but it saves the environment for ugly world holes, and it gets the job done. ;)/>

Download:
Pastebin link: http://pastebin.com/JbFMHaNg
Pastebin id: JbFMHaNg


Use as follows:
Setup inventory as follows:
Slot 1: Enderchest if you want automatic inventory disposal.
Slot 2: Fuel, if you want automatic fuelling.
Slot 3: Materials for filling holes, if you want holes to be filled.
Slot 4-15: Blocks to ignore.
Slot 16: Empty
Then run the program as follows:
dig <length> <width> <right(r )/left(l)>
Example:
dig 25 25 r
This makes the turtle mine a 25 by 25 area, starting to move to the right.

You can also run the program without input parameters, to display help instructions.

The current features are:
-Saves the progress and resumes where it left off when it's rebooted.
-Can specify up to 12 blocks to ignore. And will toss all unwanted blocks.
-It digs holes in a pattern similar to where the water is located in the most space efficient reed farm. (The X's in the diagram below)


. X . . . . X . . .
. . . . X . . . . X
. . X . . . . X . .
X . . . . X . . . .
. . . X . . . . X .
. X . . . . X . . .
. . . . X . . . . X
. . X . . . . X . .
X . . . . X . . . .
. . . X . . . . X .

-Digs until it hits bedrock for each hole.
-Automatic item disposal to an enderchest, and a choice for manual inventory handling if you prefer that.
-Smart digging and moving: can handle gravel, sand and mobs.
-Autofueling.
-Filling the top layer of the holes with a block type specified.

Planned features:
-Wireless control.
-Some sort of gui or menu.
-Better manual handling of the inventory (getting out of the hole when the inventory is full or something similar).
-Specify a dig height, instead of digging straight to bedrock.
-Automatically updating if a new version of the script is available.
-Enderchest support for refuelling.

Dependencies:
-Enabled http


It depends on two other programs as well (there's on need to download them, the dig program does this by itself if they're not installed). If you want to take a look at them, here's the links:
Move and dig API: http://pastebin.com/s8GSFZrU
startup program: http://pastebin.com/CDCELxfj

I appreciate inputs if you use this program. :)/> And please report bugs if you find any!
Jack #2
Posted 28 December 2012 - 04:01 AM
Interesting! It might be nice if it could detect useful ores around it and mine those. It's a good concept and it works. Nice job.
eonsv #3
Posted 28 December 2012 - 09:54 PM
I'm not sure of what you mean by detecting usefull ores and mine those. Do you mean that if it detects some ores it will mine the whole vein? Or just mine those adjacent to it? As it already does the last one, if the blocks aren't stone or dirt. Or do you want to specify which ores to find and collect instead of which to not collect? Anyway thanks for feedback! :)/>
Jack #4
Posted 29 December 2012 - 01:42 AM
Let me take another look at that code.

There's no need to mine the whole vein; it already takes care of that with its mining pattern. Maybe I'm being a little obtuse… but where's the main loop located? I see a lot of nice functions, but where does it execute the pattern and dig?

Anyway, I was just going to suggest a way of preconfiguring the turtle. Ideally, I see this turtle as containing a fuel slot, and in all the other slots, samples of the block types that should be ignored. At the beginning of the program, it should identify which slots (besides fuel) are non-empty, and add their indices to a list. Then, as it mines, it compares only to those in the list and tosses those that match. It would be highly configurable and easy to use. And possibly impossible to program. :)/>
eonsv #5
Posted 29 December 2012 - 01:56 AM
Aha, I see what you mean now :)/> Thanks for the ideas! I've never thought about having a slot for fuel. The main function(or main loop as you call it) is at the very bottom of the script (Labeled –MAIN–). I'll implement your ideas and comment the code when I get the time. (It shouldn't be impossible as I've done something similar with a treefarm program).
meanoboy #6
Posted 29 December 2012 - 09:38 PM
So I seem to have an issue with getting this program to work for me. Perhaps im doing something wrong, but instead of the turtle putting stuff into the Enderchest, it dumps it all on the ground and keeps digging. I end up losing lots of stuff in lava. All I did was follow the instructions as to where I place the chest and other blocks. It took off like i would expect after giving it everything it asked for. As to all the mods im using, Im using FTB laucher and direwolf20's mod pack.
eonsv #7
Posted 29 December 2012 - 10:57 PM
Seems like i did a huge derp in the item disposal part of the script. I'll fix it asap. Thanks for the heads up! :)/> And sorry for the loss of your items.

Edit: it shoud be fixed now.
Jorgun #8
Posted 31 December 2012 - 07:35 AM
love this program bur ran into a proble,
the protLib api was not loading on reboot so i added it to my startup program
as for idea, add a slot for cobble and make it plug the hole when it comes back up
eonsv #9
Posted 31 December 2012 - 11:29 PM
Thanks for the heads up with that bug, and for your idea! :)/> I'll implement it as soon as I can, as that's a very handy feature. And I've fixed the bug, just redownload the script. ;)/>

Edit: I've updated the program to include Jack's and Jorgun's suggestions, as well as some bug fixes.
Kane Hart #10
Posted 02 January 2013 - 04:01 PM
It says auto fuel but I don't see any info on how does it get more fuel? Does it grab it from a ender chest or something else?
eonsv #11
Posted 02 January 2013 - 04:30 PM
It will grab fuel which is mined, if it is similar to the type you initially put in. Therefore it will use coal it finds while mining if you inserted coal. I'll maybe implement an enderchest for fuel some time later if I find it necessary.
Kane Hart #12
Posted 02 January 2013 - 04:49 PM
It will grab fuel which is mined, if it is similar to the type you initially put in. Therefore it will use coal it finds while mining if you inserted coal. I'll maybe implement an enderchest for fuel some time later if I find it necessary.

Have you ever ran out of coal before while mining? That was actually what I was worried about myself. I think coal was nerfed a bit more too.
eonsv #13
Posted 02 January 2013 - 04:53 PM
Nope I haven't had that problem, but my quarries are usually not really huge. If it does run out, it will just stop and wait for you to insert some coal before continuing. I'll make it stop before digging a hole if it hasn't got enough fuel for digging and getting back up, when i get time. So it won't get stuck down there.
simwah #14
Posted 02 January 2013 - 05:53 PM
Does that mean your commenting is wrong around the refill section, it mentions enderchest?
eonsv #15
Posted 03 January 2013 - 01:17 AM
Does that mean your commenting is wrong around the refill section, it mentions enderchest?

There is no mentioning of an enderchest in the refill part of the code. I rechecked just to be certain as well, and I didn't find anything. So I'm a bit confused now :P/>
simwah #16
Posted 03 January 2013 - 01:39 AM
Sorry i was refeerence a wrong pastebin file. ignore my comment
simwah #17
Posted 03 January 2013 - 02:16 AM
Just noticed, if i do the follow.

Ender in slot 1, 64 stack of coal in slot 2, 64 stack of cobble in slot 3, gravel in 4, dirt in 5, sand in 6 and stone in 7
then run dig 64 64 left 67

The bot dump the coal on the ground and shuffles all the stock in the inventory up 1, (cobble goes into 2, gravel 3, dirt 4, sand 5, and stone 6)
The bot then just keeps asking for refulling, if i dump a few stacks in slots 7-15 it will suck up the coal and start
eonsv #18
Posted 03 January 2013 - 02:35 AM
Thanks for letting me know about that issue, it should be fixed now (I used that as a test when I implemented some new stuff, and forgot about it). If you want to let the turtle refuel itself when it gets low on fuel, instead of fuelling it up at the beginning, then just don't use the fourth parameter.
Kane Hart #19
Posted 03 January 2013 - 07:16 PM
so if you place ender chest in 1 it auto dumps items into it?
eonsv #20
Posted 03 January 2013 - 11:18 PM
Exactly :)/>
Kane Hart #21
Posted 03 January 2013 - 11:50 PM
Exactly :)/>
Pretty sweet thanks!
simwah #22
Posted 06 January 2013 - 12:43 AM
My turtles are stopping at the top after a few shafts with

dig:250: attempt to index ? (a nil value)
eonsv #23
Posted 06 January 2013 - 01:29 AM
My turtles are stopping at the top after a few shafts with

dig:250: attempt to index ? (a nil value)

Which version are you using? (I've written the version number at the top of the script.)
simwah #24
Posted 06 January 2013 - 04:20 PM
was just pullling it from paste bin, was doing a dig 64 64 right
bruteman #25
Posted 07 January 2013 - 01:07 AM
Nice program works well for me. One issue I am seeing is when the turtle is retracting up the hole if a slime or mob gets on top if it it just gets stuck there it doesn't auto attack the mobs on retraction.
eonsv #26
Posted 07 January 2013 - 04:29 AM
was just pullling it from paste bin, was doing a dig 64 64 right
I can't replicate your problem. And therefore i can't help you if you don't tell me what version of the script you are using. Also what is your inventory setup?
Nice program works well for me. One issue I am seeing is when the turtle is retracting up the hole if a slime or mob gets on top if it it just gets stuck there it doesn't auto attack the mobs on retraction.
I can't replicate your problem either. It works as intended when I've tried to place a mob on top of the turtle when it is moving upwards. Were you using an enderchest with the turtle? It might have tried to place an enderchest and couldn't due to the mob being on top. I've updated the script to handle this case, please tell me if you still got the same problem with the new one.
simwah #27
Posted 07 January 2013 - 10:42 AM
Using the latest from pastebin. 0.2.11

1: Enderchest
2: Coal
3: Stack ofDirt
4: Stone
5: Dirt
6: Sand
7: Gravel

If i force the turtle to exit and reboot, it starts again.

Error: 63.2% complete on a dig 40 40 left
dog:251: attempt to index ? (a nil value)
eonsv #28
Posted 07 January 2013 - 03:55 PM
I think I found the problem, and fixed it. Thanks for pointing it out :)/>
simwah #29
Posted 07 January 2013 - 06:43 PM
I shall let you know. We have about 12 turtles running 64x64
Mr_Pryor #30
Posted 21 January 2013 - 03:18 AM
Nice Job Copying Henness's Program.
 http://www.computercraft.info/forums2/index.php?/topic/1125-advanced-programs-updater-gui-tunnel-orefinder-now-with-session-persistence/
Freman #31
Posted 22 January 2013 - 08:31 PM
Hi, I'm having a problem with the scripts constantly failing very early on, especially since this latest update


8.5% complete.
io:71: Too long without yielding

I've tried rebooting but I get nil in the sleep function and frequently the save file is blank (or blanked)
sjkeegs #32
Posted 23 January 2013 - 03:24 AM
Nice Job Copying Henness's Program.
This actually looks quite different than Henness's shaft miner.
cyclotis04 #33
Posted 23 January 2013 - 02:38 PM
I'd like to see more options for "ignored" materials. Perhaps I wouldn't mind collecting all the gravel that I may get, but don't want to go out of my way to get it. The turtle could collect at least a full stack, and drop it in the enderchest if available.

Other than that, this looks like a fantastic program and I have it in my turtles now!
helifreak #34
Posted 26 January 2013 - 05:59 PM
I found a bug with your startup program. If you have downloaded/written any other scripts for the turtle, there is a chance that the turtle will load the wrong script. Specifically, it will be a problem if there is a program whose name is alphabetically after the digging program. Perhaps you could save the name of the digging program when you first run it? I could've sworn I saw a command to get the process' file name but I can't find it anymore.
Jharii #35
Posted 27 January 2013 - 01:49 AM
Line 335.

while(turtle.getFuelLEvel() < fuel) do

This should be…

while(turtle.getFuelLevel() < fuel) do

Nice program, though! I am going to have to try it out.
eonsv #36
Posted 28 January 2013 - 04:01 AM
@Jharii
Thanks for pointing that out!

@helifreak
I'll fix that in the next version, until then use a turtle without any other programs installed.

@cyclotis04
Thanks for the idea. I'll make the turtle fill up the slots with the ignored blocks.
ughzug #37
Posted 01 February 2013 - 01:16 AM
works great just needs a kill command to wipe the tables so if i need to stop it and replace it, it doesnt restart and take off on the old memory.
helifreak #38
Posted 03 February 2013 - 03:42 PM
works great just needs a kill command to wipe the tables so if i need to stop it and replace it, it doesnt restart and take off on the old memory.
Hold Ctrl and T.
ughzug #39
Posted 04 February 2013 - 01:59 AM
works great just needs a kill command to wipe the tables so if i need to stop it and replace it, it doesnt restart and take off on the old memory.
Hold Ctrl and T.

that wont work, because once its place down again it takes off on the old table, like i said it needs a restart button to overwrite the resume functionality. the only way now is to clear the label and break the turtle re place and reinstall program.
eonsv #40
Posted 05 February 2013 - 11:59 AM
I'll make the turtle stop mining at startup if you apply a redstone signal to it, in the next update.
helifreak #41
Posted 10 February 2013 - 01:19 AM
Hold Ctrl and T.

that wont work, because once its place down again it takes off on the old table, like i said it needs a restart button to overwrite the resume functionality. the only way now is to clear the label and break the turtle re place and reinstall program.
"rm save" should remove the save file.
jycs #42
Posted 02 April 2013 - 05:41 AM
The best mining appli.

don't forget the "label set <name>" to save.
wakafanykai123 #43
Posted 18 May 2013 - 01:03 PM
This topic has been abandoned? I personally love this program.
eonsv #44
Posted 21 May 2013 - 08:12 PM
Yes, I've currently abandoned this project, unfortunately. Due to to the fact that I'm not that into computercraft anymore, or minecraft in general. If however I start using this script again, then I'll post the updated versions. But no promises though.
Vorg #45
Posted 22 May 2013 - 02:29 PM
Looks a bit like this: http://www.computercraft.info/forums2/index.php?/topic/1125-advanced-programs-orefinder-tunnel/ which mines what you want instead of tossing what you don't. That script seems broke atm though.
Jack #46
Posted 27 May 2013 - 10:50 AM
Oh, hey! This is still here! :)/>

I'm just getting back into CC after a nice long break, and this program is proving extremely useful. The only feature I could think to add would be chest dropoff (such as in the built-in excavate program).