King's Branch Mining Script
KingofGamesYami 25 Jul 2014
What it does
1. Refuels using external lava source, if encountered in the mining process.
2. Allows a certain amount of time to be spent mining.
3. Checks the inventory constantly to prevent ore from being mining but not collected.
4. Returns to base when:
-Out of Fuel
-Out of Space
-Mining time is up
5. Drops all items into a chest at the start when finished.
6. Mines recursively to extract every piece of ore possible.
7. Identifies ore by comparing it to "waste" blocks in it's inventory ( stone, dirt, sand, gravel)
-Pro: Can be easily used in a modpack
-Con: Will identify wood/chests/etc. as ore if it runs into it.
8. Standard branch mining procedure, leaves 3 blocks between branches.
9. Constantly reduces the waste items stacks to a single item, preventing gravel/dirt/sand from overwhelming the turtles inventory.
10. Logs it's progress on screen and in a file named "turtleLog"
11. NEW! Turtle now senses the amount of waste blocks you've added to it's inventory.
12. NEW! Turtle will now detect chests & other inventories! (credit to Mirodin for some advice)
Set up
1. Place a chest down on the level you want to mine (I suggest ~10) and place the turtle immediately on top of it.
2. Place any amount of waste blocks in the top slots (1 - ?) of the turtle's inventory. (I suggest placing stone (not cobblestone) in the first slot, for maximum efficiency time-wise, and limiting the amount of waste blocks as much as possible. If you know the area the turtle will be mining in, you should adjust your blocks accordingly (eg. if there is an abundance of obsidian that you don't want, add that in.)
3. Place an empty bucket in slot 15, and any fuel you wish the turtle to use in slot 16.
4. Download the turtle mining script: pastebin get ZpKSLTgW*
5. Run the script with the proper command line arguments. Here are some examples:
-miner 1 hours
+Runs for 1 hour, note you must use "hours" instead of "hour"1
-miner 1 hours 15 minutes
+Runs for 1 hour, 15 minutes. Again note you must use the plural version regardless if the number is singular.1
-miner 15 minutes 10 seconds
+Runs for 15 minutes, 10 seconds
1Update: I may have fixed this (with pattern magic) to completely ignore the "s" at the end. Please report any issues found with this system.
Problems Identified
1. The turtle will mine mossy cobble, cobblestone, wooden planks, grass blocks, and dungeon chests thinking they are ore.
2. The turtle will incorrectly identify lava in front of it, when in fact the lava is in front and down, due to the fact that the bucket will pick it up. Unfortunately, liquid is not detectable, and as such I cannot differentiate between the two. This has been fixed. For information on my fix, see the spoiler "detecting liquids"
3. We'll have to see if any other problems come up, since I have not found any others.
Download
pastebin get ZpKSLTgW*
*note: the pastebin will remain the same throughout all versions of this program, and is set to never expire. If there is a download failure, it is most likely caused by pastebin being under heavy load. I reserve the right to change the code at any time without warning. If any bugs are identified, I will work on fixing them and update this topic accordingly.
Edited by KingofGamesYami, 27 July 2014 - 02:45 PM.
1. Refuels using external lava source, if encountered in the mining process.
2. Allows a certain amount of time to be spent mining.
3. Checks the inventory constantly to prevent ore from being mining but not collected.
4. Returns to base when:
-Out of Fuel
-Out of Space
-Mining time is up
5. Drops all items into a chest at the start when finished.
6. Mines recursively to extract every piece of ore possible.
7. Identifies ore by comparing it to "waste" blocks in it's inventory ( stone, dirt, sand, gravel)
-Pro: Can be easily used in a modpack
-Con: Will identify wood/chests/etc. as ore if it runs into it.
8. Standard branch mining procedure, leaves 3 blocks between branches.
9. Constantly reduces the waste items stacks to a single item, preventing gravel/dirt/sand from overwhelming the turtles inventory.
10. Logs it's progress on screen and in a file named "turtleLog"
11. NEW! Turtle now senses the amount of waste blocks you've added to it's inventory.
12. NEW! Turtle will now detect chests & other inventories! (credit to Mirodin for some advice)
Set up
1. Place a chest down on the level you want to mine (I suggest ~10) and place the turtle immediately on top of it.
2. Place any amount of waste blocks in the top slots (1 - ?) of the turtle's inventory. (I suggest placing stone (not cobblestone) in the first slot, for maximum efficiency time-wise, and limiting the amount of waste blocks as much as possible. If you know the area the turtle will be mining in, you should adjust your blocks accordingly (eg. if there is an abundance of obsidian that you don't want, add that in.)
3. Place an empty bucket in slot 15, and any fuel you wish the turtle to use in slot 16.
4. Download the turtle mining script: pastebin get ZpKSLTgW*
5. Run the script with the proper command line arguments. Here are some examples:
-miner 1 hours
+Runs for 1 hour, note you must use "hours" instead of "hour"1
-miner 1 hours 15 minutes
+Runs for 1 hour, 15 minutes. Again note you must use the plural version regardless if the number is singular.1
-miner 15 minutes 10 seconds
+Runs for 15 minutes, 10 seconds
1Update: I may have fixed this (with pattern magic) to completely ignore the "s" at the end. Please report any issues found with this system.
Problems Identified
1. The turtle will mine mossy cobble, cobblestone, wooden planks, grass blocks, and
3. We'll have to see if any other problems come up, since I have not found any others.
Download
pastebin get ZpKSLTgW*
detecting liquids
*note: the pastebin will remain the same throughout all versions of this program, and is set to never expire. If there is a download failure, it is most likely caused by pastebin being under heavy load. I reserve the right to change the code at any time without warning. If any bugs are identified, I will work on fixing them and update this topic accordingly.
Edited by KingofGamesYami, 27 July 2014 - 02:45 PM.
bigbrainiac10 25 Jul 2014
Loving the fuel efficiency the most, and the keeping logs too!
How about adding a table containing all the things it needs to keep:
Overall though, great job!
KingofGamesYami, on 25 July 2014 - 03:37 PM, said:
-Pro: Can be easily used in a modpack
-Con: Will identify wood/chests/etc. as ore if it runs into it.
-Con: Will identify wood/chests/etc. as ore if it runs into it.
How about adding a table containing all the things it needs to keep:
local keepTab = {oreIDHere, oreIDThere}
Overall though, great job!
Bomb Bloke 25 Jul 2014
The problem is that the turtle cannot compare blocks in front of it according to their IDs, but rather only by the blocks it's already carrying. Reserving inventory slots for all possible blocks you might want to mine (or not mine) is out of the question.
KingofGamesYami 25 Jul 2014
Bomb Bloke is correct. However, if you are playing with terrain that has different things in it (such as the nether), you could change the blocks to something different (netherwract, soulsand, etc.) I may add an optional command line variable that controls the amount of slots you want to use up while mining.
hilburn 25 Jul 2014
Quite a neat way of doing that is to sense the first X slots with blocks in and then defining those as the waste blocks
KingofGamesYami 25 Jul 2014
hilburn, on 25 July 2014 - 09:08 PM, said:
Quite a neat way of doing that is to sense the first X slots with blocks in and then defining those as the waste blocks
Good idea, I'll try it.
Edit: Added this, please report any errors you encounter. I think I'll also add some checking for stuff that should be in the turtle.
Edit of Edit: Added checking, turtle will now prompt you when it detects how many waste blocks you have, and if it detects no fuel source, as well as stopping if it is not given a bucket.
Edited by KingofGamesYami, 25 July 2014 - 09:31 PM.
Mirodin 27 Jul 2014
To return the favour for your help in my mining script and to resolve your issue with the dungeon chests.
I had a simple chest cleaning routine in my old quarry script which emptys chests before digging them. To use this you should maybe transfer your inventorycheck in a function which gets then called every single successful chest cleaning operation:
Cheers
I had a simple chest cleaning routine in my old quarry script which emptys chests before digging them. To use this you should maybe transfer your inventorycheck in a function which gets then called every single successful chest cleaning operation:
function chestCleaner() while turtle.suckUp() do inventoryCheck() end while turtle.suckDown() do inventoryCheck() end while turtle.suck() do inventoryCheck() end end -- main local stepmax = 16 for s=1, stepmax do chestCleaner() oreDetector() inventoryCheck() end
Cheers
KingofGamesYami 27 Jul 2014
Mirodin, on 27 July 2014 - 02:19 PM, said:
To return the favour for your help in my mining script and to resolve your issue with the dungeon chests. />/>
I had a simple chest cleaning routine in my old quarry script which emptys chests before digging them. To use this you should maybe transfer your inventorycheck in a function which gets then called every single successful chest cleaning operation:
Cheers
I had a simple chest cleaning routine in my old quarry script which emptys chests before digging them. To use this you should maybe transfer your inventorycheck in a function which gets then called every single successful chest cleaning operation:
function chestCleaner() while turtle.suckUp() do inventoryCheck() end while turtle.suckDown() do inventoryCheck() end while turtle.suck() do inventoryCheck() end end -- main local stepmax = 16 for s=1, stepmax do chestCleaner() oreDetector() inventoryCheck() end
Cheers
Spoiler
Edit: Just realized, this literally takes no code whatsoever...I'll just insert this in the proper places.
if turtle.detect() and turtle.suck() then while turtle.suck() do end end
Edited by KingofGamesYami, 27 July 2014 - 02:33 PM.
Vorg 03 Aug 2014
An option I don't see, maybe it is in the code. I didn't look. An option to confine it to an area. x/y with optional z so you can confine it to an area where a chunk loader is. I tried one of these branch mining programs a long time ago and didn't put sand as waste because I wanted sand. But it found desert and the turtle had a chunk loader on board and was using an ender chest to unload ......... Took long time to find it in that mess. Maybe it could be a config menu option at start up.
Edited by Vorg, 03 August 2014 - 06:35 PM.
Edited by Vorg, 03 August 2014 - 06:35 PM.
KingofGamesYami 03 Aug 2014
Vorg, on 03 August 2014 - 06:34 PM, said:
An option I don't see, maybe it is in the code. I didn't look. An option to confine it to an area. x/y with optional z so you can confine it to an area where a chunk loader is. I tried one of these branch mining programs a long time ago and didn't put sand as waste because I wanted sand. But it found desert and the turtle had a chunk loader on board and was using an ender chest to unload ......... Took long time to find it in that mess. Maybe it could be a config menu option at start up.
Edit: Also, why Z? This script will stick to the level you start it on, unless it finds something it wants to mine.
Edited by KingofGamesYami, 03 August 2014 - 11:44 PM.
Vorg 04 Aug 2014
Why Z? Most mining scripts work their way down. Do the area at a level, move down, repeat. Doing by area would best be done in place of time. So if you do look into it, make it part of the option. Do by time or do by area.
KingofGamesYami 04 Aug 2014
Vorg, on 04 August 2014 - 01:42 AM, said:
Why Z? Most mining scripts work their way down. Do the area at a level, move down, repeat. Doing by area would best be done in place of time. So if you do look into it, make it part of the option. Do by time or do by area.
XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXXwhile scanning for ores/lava/inventories.
It will never venture up or down, unless it detects an 'ore', which it will mine and scan around.
Vorg 04 Aug 2014
It can be vertical. There was one some time ago that did a center shaft vertical. It would dig a tunnel horizontal and then create branches every 3rd block coming back, then go down and do the same. I thought you did something like this:
-xxxxxxx
----------
-xxxxxxx
-xxxxxxx
-xxxxxxx
---------
-xxxxxxx
Mine a horizontal tunnel every 4th block, skipping 3 blocks and repeat. Then drop one block and repeat the pattern under where you just where offset by 2 blocks. This exposes every block but greatly reduces the amount minded if there is nothing there. If you are mining a 3 high tunnel (up/forward/down), then drop down 2 instead of 1 to keep the offset right.
BTW, The strip miner program I'm using now and was trying to patch to check chest in the thread I started is: http://www.computerc...hole-excavator/
Edited by Vorg, 04 August 2014 - 06:03 PM.
-xxxxxxx
----------
-xxxxxxx
-xxxxxxx
-xxxxxxx
---------
-xxxxxxx
Mine a horizontal tunnel every 4th block, skipping 3 blocks and repeat. Then drop one block and repeat the pattern under where you just where offset by 2 blocks. This exposes every block but greatly reduces the amount minded if there is nothing there. If you are mining a 3 high tunnel (up/forward/down), then drop down 2 instead of 1 to keep the offset right.
BTW, The strip miner program I'm using now and was trying to patch to check chest in the thread I started is: http://www.computerc...hole-excavator/
Edited by Vorg, 04 August 2014 - 06:03 PM.
KingofGamesYami 04 Aug 2014
Vorg, on 04 August 2014 - 05:59 PM, said:
-snip-
However, I may be creating a new turtle miner soon