Space Engineers

Space Engineers

AI Mining Drone Script
172 Comments
Dots Jun 6, 2024 @ 9:45pm 
mod very outdated. has not been updated in 5+ years and you waist time if you try this
Omega1102 Apr 7, 2019 @ 1:53am 
I am working on a MiningDrone with Atmospheric Thrusters. The Script is showing some obsolet lines but they don't matter.
Now my problem is i have a Oxygen generator to fuel a Hydrogen Engine. The problem is that as long as ice is in the Oxygen generator the Drone Antenna shows "waiting for unloading cargo".
Dose someone know how to exclude the Oxygen generator from the Cargo?
Enigmus Sep 7, 2018 @ 12:05pm 
I would love to try out the updated version.
Devlah Aug 30, 2018 @ 10:19pm 
Thanks PirateRockabillyPunksInSpace! I remember spending hours at a time with DerLaCroix fine-tuning and working out bugs. It was a labor of love for me, as I really enjoy the automation aspect of this game. Please be sure to give us a link to the workshop when you eventually upload it. Meanwhile, I'll keep an eye out for any functional alternatives that pop up.
TheGoudaShoota Aug 29, 2018 @ 12:14am 
@Graywolf After a bit of poking I got this to work, I still need to ensure it returns, but I at least got it to go to an asteroid, mine it, and start returning. Follow the directions exactly (especially the front and rear bit; I used a control panel, and the rear connector for them) it seems to work fine; barring code adjustments that is.

Since it seems the original person is no longer maintaining this, I might upload it with my adjustments (that will likely also become unmaintained because I just wanted this to work, and dont want to do maintaining on it).

Things of note:
ITS EXTREMELY SLOW. It takes a while for it to take off and move forward during mining. Watch your thruster group, you'll see that its slowly increasing speed when it says 'heading out'. You can hackify this by bumping the thrust, after a bit it will finally decide to start moving on its own. Same goes for mining. I'm gonna see what I can do about that because 130N is too damn slow to mine reasonably
Graywolf Aug 25, 2018 @ 1:57am 
YEAH DOES NOT WORK :(
crafter360 Aug 1, 2018 @ 7:22pm 
Like is there a specific code that works best?
crafter360 Aug 1, 2018 @ 7:09pm 
What is the best set up of commands you have found?
Kam Solastor Jul 7, 2018 @ 12:59pm 
This seems to be broken at the moment. Throwing a few exceptions.
yankeevader Nov 29, 2017 @ 11:02pm 
Hmm. so I can get the ship to depart, it goes straight out for 2km stops, switches to heading out and slowly comes back to the ship. doesnt dock or anything just kinda floats lol.

any chance this will be getting updated or anyone know of a script that does what this one did?
supersquid2000 Oct 12, 2017 @ 5:26pm 
Man I wish this worked. It would be perfect for the world I'm playing right now.
Gladi Aug 31, 2017 @ 2:21pm 
Hey any Update for this script?
Airomis Aug 20, 2017 @ 11:04am 
Is there a test drone we can use? Like the ship that you made the script with?
Enigmus Aug 11, 2017 @ 1:48pm 
Touching base to see if a solution was in site. I also wanted to request a hydrogen tank refill option during docking. The script looks too good to be true. I'm looking forward to giving it a try.
DerLaCroix  [author] Jul 29, 2017 @ 12:28pm 
It's currently broken due to new API. I'll try to fix it.
Seronjo Jul 27, 2017 @ 4:51am 
Is this script still functioning with the last updates because i have this error : http://prntscr.com/g0y0l6
I dont know how to resolve this, if someone could help me I would greatly appreciat
antriot Apr 19, 2017 @ 9:18am 
My drone keeps stucking at "Ship inizialized". I suppose I've done something wrong with the setup. Where do I have to add the comment line? Your description is not clear at this point.
Omen Apr 10, 2017 @ 1:16pm 
So i tried to use this but it keep bumping into the wall and get crocket and stuck.
Devlah Mar 11, 2017 @ 8:09pm 
It seems to be becomming popular to use GitHUB for these projects. I wonder if it might make it easier to collaborate?
c.olivie23 Mar 11, 2017 @ 8:02pm 
any chance of a 2017 update of this script?
DerLaCroix  [author] Jan 10, 2017 @ 9:35am 
@ allbad - sorry, i only have it in plaintext, with occasional older saves when I do something bigger.

@blockdude - right now, I am not aware of access to the ore detector data, and if it would give you directions you could use. I'll look into it. the range would be much better than the detector, as well
allbad Jan 10, 2017 @ 4:24am 
@DerLaCroix - Do you keep your script in source control? I'd like to contribute with merge requests.
Blockdude Jan 9, 2017 @ 7:25pm 
@DerLaCroix The sensor resets just before scanning, but couldnt you use an ore detector along with the sensor, see if there are any ores in it?
DerLaCroix  [author] Jan 9, 2017 @ 3:40pm 
@ blockdude - The autopilot is a bit erratic sine the last update in reaching it's waypoints - I'll need to give it a bit of leeway to avoid the autopilot going in circles. The second one could be due to distance to the asteroid and the form . if it scans, it scans in a 50x50 area - if it turns around to mine, it will scan forward in a cone of the ship size diameter you specified. If that happens to point towards a hole or indentation of the asteroid and cannot detect the asteroid within 50 m, it can come to the conlusion the asteroid is too far gone to be mined properly and return home. I'm thinking about trying to add a camera rayscan into the mix to improve asteroid detection. Maybe it is time for a rewrite, like when the autopilot was introduced.
allbad Jan 9, 2017 @ 10:07am 
Who has an example of a good mining drone/ship to use?
Blockdude Jan 7, 2017 @ 3:49pm 
Update2: Once the miner flies to the #TARGET, it sets the sensor to mining config, 'scans' for asteroid, then returns home after being unable to find it.
Blockdude Jan 7, 2017 @ 3:48pm 
Update: I have none of those bugs, but more have surfaced after modifying parts of the script to fix more bugs. Now when it is beging the dock prodcedure (dock1 and !dock2, aswelld as the rest). It goes to one of the waypoints, over shoots, corrects, repeat. After a few tries it claims it will attempt again after interuption, which it never recovers from.
DerLaCroix  [author] Jan 7, 2017 @ 1:21pm 
I have encountered the same problem now, as well - but I realized that this is not a script issue. Seems the new update have changed something, so that on docking and undocking, the groups might occasionally get "forgotten", somehow. Not sure how to fix this - it went away after a couple of test tries. It's a new bug, and might go away in the next updates.
Blockdude Jan 4, 2017 @ 1:19pm 
The last message it shows states it recived my arguments correctly, it shows it was Re-init'd, recivied mining coords and just to be sure I added #go so it states it will undock aswell. It is somthing about the arguments
DerLaCroix  [author] Jan 4, 2017 @ 10:34am 
what is the last message the antenna shows ?
Blockdude Jan 3, 2017 @ 2:24pm 
I have all of these, The antennas name is changed, the MEMORY is written, and the SENSOR is named correctly, all should work.
DerLaCroix  [author] Jan 3, 2017 @ 11:49am 
Do you gave the sensor block named SENSOR? and an antenna? maybe you are missing the AI_MEMORY lcd panel?
Blockdude Jan 2, 2017 @ 11:56am 
@DerKaCroix I have an issue with mine, it will run with the argument just fine, but when the timer runs it without any arguments, it throws a generic acception about how the blocks werent found, but they are all there. Thruster Groups, Remote, FRONT and REAR
DerLaCroix  [author] Dec 28, 2016 @ 9:32am 
have you initialized it while NOT being locked? You should - if it is docked while being initialized, it might confuse connectors, and is trying to unlock a different one.
Reptrillian Dec 27, 2016 @ 7:12pm 
The connector stays locked and the antennae says the batteries are 100% charged but it doesn't do anything after that, and yes I have my thruster groups made and my RC set to one way. Thanks for the reply!
DerLaCroix  [author] Dec 24, 2016 @ 4:29pm 
Do you have the Thruster groups made? FORWARD/REVERSE?
Does it stay locked (greenlight) or does it turn yellow but doesn't leave, even though it is saying "Departing".

Do you have the remote control set to "One Way?"
Reptrillian Dec 24, 2016 @ 2:14pm 
Great work, I've had this script work with varying success but my biggest problem seems to be getting the ship to leave the connector after #reinit, it says the the batteries are 100% charged but it stays locked. The cargo is empty, I have all hardware requirements, and ownership sorted out. Any ideas?
DerLaCroix  [author] Dec 22, 2016 @ 9:47am 
It should work wherever you can use a remotecontrol autopilot and have something that registers as asteroid on a sensor. I don't know if the planet ground registers as such, but there is no "planet" setting.
kapperbeast Dec 22, 2016 @ 12:41am 
would this work on a planet?
DerLaCroix  [author] Dec 21, 2016 @ 2:58pm 
Update for new Beta Api. Some changes were scriptbreaking
LoveJoy Dec 8, 2016 @ 1:52pm 
"Sorry - Wife got a child"? LOL Stuff happends for a reason you know. :)
Congratulation to BOTH of you. (or is it just the wife)

Anyway, am going to try this out, and saw you happy announcement.
DerLaCroix  [author] Dec 7, 2016 @ 3:21pm 
Sorry - wife got a child, and internet was offline for a month due to house renovation.

@Dampiir - Deprecated warning was no issue, script ran, anyway. Still, fixed in current version.

@Vilkacis - If you add an ejector system, renaming the actual ejectors(not the rest of the system) "GARBAGEDUMP", and using the GARBAGEDUMPON flag, the ship will use it to eject unwanted materials during mining (not during travel to and back, for this would clutter the area and cause issues with autopilot and other flying)
Alter Nov 12, 2016 @ 7:33am 
What exactly does #GARBAGEDUMPON do? Is there some way to use the script to eject stone, rather than having a dedicated sort/eject system?

Thanks for the great code btw. Takes a little time to work out the kinks, but works really efficiently once you figure out what it's trying to do.
Dampiir Nov 9, 2016 @ 9:28pm 
Anyone know if this still works? I keep getting errors:
Line 1254 <IMyInventoryOwner> is deprecated and after googling I found I could replace it with:
<IMyCargoContainer>
It compiled ok but when I run it with:
#TARGET GPS:Asteroid:-55263.61:89909.51:-21471.21:
It says Object reference not set to an instance of an object.
Any ideas?
Vaagventje Oct 27, 2016 @ 5:10am 
Ahh okey, ty for clearing that up :) to be honest. i havent looked at the drone for like the past 10 hours. its just doing its thing. love it.
DerLaCroix  [author] Oct 26, 2016 @ 12:00pm 
The diameter is in meters - it needs to know how big of a tunnel it needs to dig to properly know if it can fit through a hole or not.
Vaagventje Oct 25, 2016 @ 4:17pm 
Really Really nice script, with the reinitialize its actually possible to move my mining ship and it wil just remeber its new docking location :D really nice. i had a little bit of a problem at first when i by accident named the Forward thrusters revers, and the reverse thrusters as forward. gave a very.. intresting result... but its all okey now. its awaiting go permission after its 5th run to a meteor.
uhhm the only question i got is... uhhm the script needs a diameter. and in the example on this page it "int shipDiameter = 8;" now iam just wondering... 8 what? meter? small/large blocks? (depending on ship) it is working now with the "factory" setting. but maybe i was just lucky with my ship design iam not sure. but that said, Really Really nice script. nicely done
Docalophagus Oct 8, 2016 @ 3:18pm 
Nice!
DerLaCroix  [author] Oct 8, 2016 @ 3:05pm 
KaTsulChi has added a LCD save to the script, and I incorporated his changes in the new version.
DerLaCroix  [author] Oct 2, 2016 @ 7:10am 
Yeah, server reset does bad things to scripts. That solution would work fine. I might change it to that, some day.