Jump to content




Ore Collecting Miner - a very advanced mining program

turtle

42 replies to this topic

#1 BrunoZockt

  • Members
  • 56 posts
  • LocationGermany

Posted 06 August 2018 - 09:25 PM

History:

What it does:
Once started, this program will dig a main tunnel with n adjacent tunnels which length can be customized too. The interesting thing is that this program will find and mine ores that it comes across so that there is no work left to do for you.

Posted Image Posted Image

Requirements:
Although I did program it to work pre 1.64 I've never tested it out, so no garanties. It is optimized for Computercraft Version 1.64 or higher.
An advanced turtle is required due to the color and mouse support

Key features:
  • automatic update
  • Automatically continues after world reload/server restart
  • intuitive, clean layout to navigate through the starting process
  • supports the EnderStorage enderchest
  • completly customizable and savable settings
  • Anti-Mobspawn-Torch-Algorithm-Thing (scientificly reffered to as AMTAT)
  • Autofuel
  • place floor
  • place walls and ceiling
  • Ignor-list
  • Throw away trash
  • Stable af:
    • gravel-proof
    • water-/lavaproof
    • mob-proof
    • wont crash when out of fuel
    • will place torches under any circumstances
    • wont crash when materials (e.g. torches or chest) are missing
    • fuel = "unlimited" -proof
What about those quarry programs?
Well, this program wont move in height and therefore be a lot more efficient if you are searching for specific ores since their occurrence depends on the level above bedrock.
Also, this program doesn't destroy a huge area, you can easily run it in your cellar.

Known Bugs:
Walls aren't placed consistently.

Planned features:
Disclaimer: I am not as motivated and heavily invested in the developement of this program as I was when posting this, these features may therefore never be realised. Sorry.
  • automatically continue after server restart (very difficult but I'm working on it and it will probably come within the next patch before October)
  • option to let the turtle dig down before starting so that you can execute this program from the surface
  • snail option (Currently working on it and it's rather easy but very hard to implement into the existing code.)
  • test all the code for Version < 1.64 and make it compatible
  • make all Buttons clickable so that you can use the entire program with only one hand, leaving the other hand to eat crisps for ultimate comfort
  • live feedback screen while the turtle is running to see progress in %, estimated time, true time etc.
  • write custom read function or use existing API (if I find a good one) to optimize the options page further
  • implement chunkloaders (very difficult, so be patient)
Installation:
The code can be found on pastebin and therefore also be used in your turtle directly via "pastebin get gkz5sgZ8 OCM"
On first startup you need an internet connection and the http API activated, so that my program can install all its dependancies itself.
Since it's quite a complex program you're gonna need more than 100kb of free storage which shouldn't be a problem but might be restricted if you are playing on a server.

I hope this program turns out to be useful to some of you. I would love to get some feedback. Suggestions, bug reports, english corrections etc. are also very welcome!

Cheers,
Bruno

PS: As you can see I haven't posted too much yet and don't really know the editor that well, any ideas how I can keep the "key features" section cleaner? It looks really bad with all those spoilers...

Edited by BrunoZockt, 09 June 2019 - 08:24 PM.


#2 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 07 August 2018 - 01:45 AM

I'd decrease the default space between tunnels from three to two, as you're potentially missing a lot of ore.

Spoiler


#3 BrunoZockt

  • Members
  • 56 posts
  • LocationGermany

Posted 07 August 2018 - 06:11 AM

View PostBomb Bloke, on 07 August 2018 - 01:45 AM, said:

I'd decrease the default space between tunnels from three to two, as you're potentially missing a lot of ore.

Spoiler

Thanks a lot for your feedback!

space between tunnels

Formatting tips


#4 SquidDev

    Frickin' laser beams

  • Members
  • 1,404 posts
  • LocationDoes anyone put something serious here?

Posted 07 August 2018 - 06:34 AM

Wow, this is a jolly cool program! I rarely go beyond "while true do turtle.forward() turtle.dig()", so am always impressed when people do fancy ore excavation programs.

View PostBomb Bloke, on 07 August 2018 - 01:45 AM, said:

I'd decrease the default space between tunnels from three to two, as you're potentially missing a lot of ore.
I seem to remember someone crunched the numbers ages ago and a gap of 6 is the most "efficient" in terms of a block:ore ratio. However, I guess there's an argument that this'll just be running in the background, so it's better to get maximum utilisation from the area as time isn't the bottleneck.

#5 BrunoZockt

  • Members
  • 56 posts
  • LocationGermany

Posted 07 August 2018 - 07:37 AM

View PostSquidDev, on 07 August 2018 - 06:34 AM, said:

Wow, this is a jolly cool program! I rarely go beyond "while true do turtle.forward() turtle.dig()", so am always impressed when people do fancy ore excavation programs.
Thank you! ^_^

#6 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 07 August 2018 - 11:01 AM

View PostSquidDev, on 07 August 2018 - 06:34 AM, said:

However, I guess there's an argument that this'll just be running in the background, so it's better to get maximum utilisation from the area as time isn't the bottleneck.

In "plot based" world I'd agree, but now that's it's been mentioned, I do feel that time's more important. Under "normal" circumstances we have access to an effectively infinite area to mine in, but background process or not, we'll never have an infinite amount of time.

#7 doctorwhofan92

  • Members
  • 17 posts

Posted 13 August 2018 - 02:00 AM

Would it be possible to make it so that the turtle auto-fills the walls/ceiling so that in the case of lava or water the 'hallway' is still usable by the player?

#8 BrunoZockt

  • Members
  • 56 posts
  • LocationGermany

Posted 17 August 2018 - 11:42 PM

View Postdoctorwhofan92, on 13 August 2018 - 02:00 AM, said:

Would it be possible to make it so that the turtle auto-fills the walls/ceiling so that in the case of lava or water the 'hallway' is still usable by the player?
Hi, pls excuse the wait.
I actually had that on my features-list but removed it because I was too lazy and thought nobody would need it anyway. I mean the turtle is coming back so you shouldn't have to go in there ;)
However now that it's been requested I'll get coding :D

#9 BrunoZockt

  • Members
  • 56 posts
  • LocationGermany

Posted 19 August 2018 - 02:57 PM

New Update!
Note that this update will be installed automatically if you've already dowloaded this program.

Features:
  • You can now choose to let the turtle build walls and ceiling to prevent the hallways from being flooded by water or lava.
  • If torches need to be placed, the turtle will now determine it's cardial direction at the beginning of digging.
  • When trash-option or chest-option is true, the turtle will now keep 1 Stack of cobblestone to place floor or walls, if selected.

Bug fixes:
  • There was a 50% chance (turtle heading north or south) that 50% of the torches (either on the right or the left crosstunnel) were lost. That is because torches are by default placed heading west if possible. The turtle will now determine where it is heading and adjust the way it places torches accordingly so that it never loses a single torch.
  • When in default settings 'chest' was set to 'none' there would be a slot for a chest anyways.
  • I missed two instances in my code that would cause a crash when no cobblestone was available. However the probability to hit this crash was soooo low that I'm sure nobody ever encountered it.


#10 doctorwhofan92

  • Members
  • 17 posts

Posted 21 August 2018 - 04:22 PM

Hey I'm getting a 'OCM:2199: Expected Number' Error on one of my turtles also one of the options just says 'Nil'

#11 BrunoZockt

  • Members
  • 56 posts
  • LocationGermany

Posted 22 August 2018 - 06:28 PM

View Postdoctorwhofan92, on 21 August 2018 - 04:22 PM, said:

Hey I'm getting a 'OCM:2199: Expected Number' Error on one of my turtles also one of the options just says 'Nil'
Hi, I'm sorry to hear that. However I'd need to know your Computercraft Version (written at the top-left of your screen) to help you.

#12 BrunoZockt

  • Members
  • 56 posts
  • LocationGermany

Posted 22 August 2018 - 09:59 PM

View PostBrunoZockt, on 22 August 2018 - 06:28 PM, said:

View Postdoctorwhofan92, on 21 August 2018 - 04:22 PM, said:

Hey I'm getting a 'OCM:2199: Expected Number' Error on one of my turtles also one of the options just says 'Nil'
Hi, I'm sorry to hear that. However I'd need to know your Computercraft Version (written at the top-left of your screen) to help you.
Forget that, I know what happend. You didn't place your turtle in front of a wall/stone. That - or 1 cobblestone in the inventory - is required. However I hot fixed it now to also accept any other block. Easiest way around this, as I said, is to just place the turtle in front of a wall. I mean after all it's for mining right? So why even place it in open space?

Edited by BrunoZockt, 22 August 2018 - 10:00 PM.


#13 doctorwhofan92

  • Members
  • 17 posts

Posted 31 August 2018 - 02:25 AM

When the 'Build wall' option is set it isn't replacing lava with a block I think this is due to lava being in that space not it being air? also would it be possible to make it so that when chest is selected it doesn't have to be a vanilla chest because I'd prefer to put a resonant strongbox or a tesseract in it

#14 BrunoZockt

  • Members
  • 56 posts
  • LocationGermany

Posted 03 September 2018 - 12:30 PM

View Postdoctorwhofan92, on 31 August 2018 - 02:25 AM, said:

When the 'Build wall' option is set it isn't replacing lava with a block I think this is due to lava being in that space not it being air? also would it be possible to make it so that when chest is selected it doesn't have to be a vanilla chest because I'd prefer to put a resonant strongbox or a tesseract in it
Thanks for reporting the Bug and the suggestion to implement other mod chests. I've already coded both but the next version will also implement automatic resuming which I am almost done with but there is still a bit of work to do.
The new version will probably be released within the next two weeks, you'll have to be patient until then :unsure:

#15 doctorwhofan92

  • Members
  • 17 posts

Posted 13 September 2018 - 04:02 PM

Thanks! I LOVE your program it's the one I try to always use!

#16 BrunoZockt

  • Members
  • 56 posts
  • LocationGermany

Posted 17 September 2018 - 07:29 PM

New Update! V2.6
Note that this update will be installed automatically if you've already dowloaded this program.

Features:
  • The program will now continue automatically after a server restart. To achieve this it is very important that there is always one torch available so that the turtle can orientate itself. Every command that needs to be executed is written to an extern file, which also takes up some disk space (very unlikely to exceed 10kb). So make sure that there is some file space left.
  • The program will also install my Startup Handler in 'startup' so that it can be automatically executed. Any file existing in 'startup' will be moved to 'old_startup' and called whenever there is no program that needs to be resumed.
  • The options 'chest' and 'enderchest' are now compatible with all the chests from the mods 'Iron chests' and 'Thermal Expansion'.
  • The path of the external files is now including your program name so that you could have multiple instances of the program on one turtle. The updater had to be modified aswell.
Bug fixes:
  • The 'place Walls'-option will now place walls in water or lava like it was originally supposed to (quite stupid mistake on my part).

Edited by BrunoZockt, 17 September 2018 - 09:01 PM.


#17 doctorwhofan92

  • Members
  • 17 posts

Posted 27 September 2018 - 10:25 PM

I hate being *That* guy but I'm getting an error when attempting to use an obsidian chest from iron chest mod. It isn't registering it as a chest

also getting the error "Unknown chunk:21: attempt to perform arithmetic on global 'k' (a nil value)"

#18 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 29 September 2018 - 10:42 AM

To get a certain chest to register, Bruno would need to know the internal name the turtle sees when it calls turtle.inspect() with the desired container in front of it. You might consider providing the names of all the other chests in the mod, too.

#19 BrunoZockt

  • Members
  • 56 posts
  • LocationGermany

Posted 03 October 2018 - 06:24 PM

View Postdoctorwhofan92, on 27 September 2018 - 10:25 PM, said:

I hate being *That* guy but I'm getting an error when attempting to use an obsidian chest from iron chest mod. It isn't registering it as a chest also getting the error "Unknown chunk:21: attempt to perform arithmetic on global 'k' (a nil value)"
Unfortunately I don't have access to my PC and won't for the next week either, so I can't check this out. However there are only 2 possibilities:
1. You picked the wrong option. In the settings you have the possibility to choose between 'chest' and 'enderchest'. With any chest that saves it's inventory (e.g. Enderchest or tesseract) you'd have to pick 'enderchest'. With every other chest (e.g. normal chest or iron chest) you'd have to pick 'chest'. If I'm not mistaken that means you'd have to pick 'chest' for the obsidian chest to work.
2. I didn't include it. In that case all you can do for the time being is adding it to the table containing all the other chest IDs (I don't remember its name from the top of my head but it is definitly easy to find within the first 100 lines of code, since I've cleaned up the variables) and comment out the call of 'update()', which you can find within the last 50 lines of code. To add the ID to the master branch of the code (not before october 9th) , I'd need to know the item ID as Bomb Bloke mentioned.
Lastly, did the error message only occur trying to use the obsidian chest or at some other point? Because if it did happen at some other point, I could't do anything about it unless you could tell me when it crashed (The error message could mean anything). Perfect would be if you recreated the crash and sent me the folder "rom/database/..programname../resume", "programname" being the name you gave my program.
Written on mobile... I'm sorry.

Edited by BrunoZockt, 04 October 2018 - 08:07 AM.


#20 doctorwhofan92

  • Members
  • 17 posts

Posted 04 October 2018 - 09:35 AM

The crash appears while using a normal chest right after it begins mining. I'd say normally 3 blocks on the first shaft is when it normally appears.





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users