Space Engineers

Space Engineers

Not enough ratings
Kristofs Lazy Drill script
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
50.608 KB
20 Sep, 2019 @ 7:09am
17 Oct, 2019 @ 12:09pm
6 Change Notes ( view )

Subscribe to download
Kristofs Lazy Drill script

Description
You want a drill on you grid that uses a ROTOR and a GROUP OF PISTONS to move a GROUP OF DRILLS downward in a circle ? Maybe even 2 groups of PISTONS ? One to go down and one to move out ? You would like this drill to turn arround and go down/out automatically until all pîstons are used 100%.
Look no further, this script does it all.

Also if you have a drill already with a rotor and pistons, you can use this script as you can adapt the group names it uses in CUSTOM DATA. Almost all settings can be changed in custom data.

Have a look at the linked demo build to see a working version.
https://gtm.steamproxy.vip/sharedfiles/filedetails/?id=1867870454

Babbayega also build another drill demo here : https://gtm.steamproxy.vip/sharedfiles/filedetails/?id=1885258379

It will move the rotor between its MIN and MAX and back; and at each end point move ONE of the pistons of group 1 down a bit. Then the rotor starts again. Untill we reach the end of pistons in group 1. IF you have a group 2 pistons, then we retract all pistons 1, extend one of group 2, and the whole process starts again with the pistons of group 1.

EXTRA feature : it makes the rotor go faster when the drills do not touch any voxels, and slow down when they do.
The rotor accelerates and brakes when it is closer to the end or further away to ensure a safe stop at the end.

You control all by creating groups, and variables in the CUSTOM DATA of the PB enable you set the speed of the rotor (slow and fast), extension of both piston groups,


How should you use it ?

NOTE : everywhere that you see (*) below, it means you can change it yourself if you do not like the default name or setting, or if you have a build that uses other names. This will be explained further in this setup info.

1. Build yourself a nice grid with an (advanced) ROTOR and call it "Rotor" (*) (capital R !!)
Set the MIN and MAX of this rotor to values from -360 to 360. Leaving them to infinite does NOT work. The rotor needs an end point. The script will check this.

2. The rotor speed is set by 2 variables (*). Default it is 0.5 slow (when the drills hit something) and 3 fast, when the drills don't hit something. The script adapts the speed between these 2.

IMPORTANT TIP : put a SORTER on your conveyor going from your drills to PULL all ore out of your drills.
The speed is determined by checking if the drill is empty or not. So you need to get the ore out.

3. Build some pistons for the first direction you want your drill to extend to. and put them in a group called "down" (*).
By default these pistons will extend 0.5m (*) each time. The speed is set to 0.3 (*) by default;

4. Build some drills at the end of the piston group 1 and put them in a group called "drills" (*).
No need to turn them on.

5. OPTIONAL : do you want another group of pistons for a second movement after all of group1 are done ?
(group 1 full done - group 2 extend a bit - group 1 redo all - group 2 extend a bit again - group 1 redo all ... until all done of group 2)
Build the pistons and put them in a group with name "outward" (*).
They will be extended each time according to a variable extendamountpiston2 (*) default of 5m ;


6. OPTIONAL but recommended. Put an LCD on your grid and call it "lazydrills" (*)
If the LCD is not found, the status is displayed on the programming block display.

7. Put a programmable block on the grid and put this script on it.
CHECK the code and it will start. the LCD will display errors or if none, status NONE. You are ready to drill !!

The script will create at first run an overview of all variables you can change in CUSTOM DATA of the programmable block. All group names and variables indicated above with (*) can be changed in this custom data section !

Here is an example how it should look:

[Lazydrill_Settings]
DrillRotor=Rotor
LCD_Name=lazydrills
Pistongroup1name=down
Pistongroup2name=outward
Drillgroupname=drills
rotorspeed=0.5
rotorspeedfast=3
extendamountpiston1=0.5
extendamountpiston2=5
pistonspeed=0.3



8. Give commands;

reset : all pistons are reset AND retracted and settings are reloaded. Use stop instead if you do not want to lose progress

start : starts or continues drilling (not possible if the state is error)

stop : stops the drills and the rotor.

When stopped, you can make changes if you want, like manually extending pistons or even adding pistons and drills. When start is used, the code will find the changes and continue drilling using the changes. Pistons are not retracted.

retract1
retract2
retractall : Retract all pistons from group1, group2 or both groups

ALWAYS use STOP before making any changes, and START again after.



You are allowed to re-use and adapt my script, just give me some feedback.
Let me know what you think of the script and any suggestions are welcome



Happy drilling !

Kristof

24 Comments
Huey 8 Mar, 2023 @ 6:29am 
Nice script in theory but it does one revolution, extends once (in midair, no voxels) then immediately complains about a stuck drill head and resets to zero extension. I might fork it and see if I can resolve the issue.
Axel-of-Atheara 18 Jan, 2023 @ 10:51am 
@KristofRaver, Is there a way to use this script with a group of pistons that extend downward and a group that extends upward in order to drill deeper?
Davetiger 5 Mar, 2021 @ 12:29pm 
I just removed the "stop" check and now it's working fine thank you for this awesome script
Davetiger 5 Mar, 2021 @ 12:02pm 
ok after watching it for serveral hours I realize it's even worse the "stuck" keeps saying it's stuck when it isn't the drill was free moving and it just says it's stuck tries to rip it out of the ground and blows the whole thing up :(
Davetiger 5 Mar, 2021 @ 6:30am 
Hey love this script I have 1 issue and wanted to know if there is anything I can do, I need it to stop auto extracting when there is an issue, I have 10 pistons on the kraken and everytime it thinks it's stuck it rips them out of the ground and piston head releases which drops the entire thing down the hole and I can't blueprint the setup because of the stupid projector past piston crap, but I rebuilt it 3 times yesterday and it gained less than 1 large cargo for all my trouble the pistons where all extracting at once which was entirely too fast for the weight.
Babbayega 17 Feb, 2020 @ 12:13pm 
so, if i have a drill rig with several piston groups, some start out extended, some start out retracted. would this script be able to Extend/retract them in order to drill? meaning meaning a way to set stage one and two piston groups to be known as starting extended, stage three thru six start retracted. being able to know when each stage completes to start the next based upon the piston position?

I was trying to avoid timers, just not learned enough coding yet to understand how to check if a piston is in X position, and if not wait until it is before continuing.
KristofDeRaver  [author] 17 Oct, 2019 @ 12:25pm 
Version 1.5 changes ( see change notes)
Bug fix : removed command that would restart drilling on opening a save game
Drill inventory explosion protection : pause drilling if your drills get full
Cargo container option : use a group and percentage to pause drilling if the max is reached.
Several small improvements
KristofDeRaver  [author] 10 Oct, 2019 @ 5:09am 
Version 1.4 changes (see change notes for details):
Support modded pistons > 10m range,
recovery mode (auto recover when drill gets stuck or hits obstacle)
kickstart command ; auto position drill head to ground level at start
KristofDeRaver  [author] 10 Oct, 2019 @ 5:03am 
@Babbayega : thanks, I will have to check it out. Have a look at the new script version. It could support your modded pistons I hope. Also the kickstart and recovery features I think are great. It helps to get ore in fast. Let me know if it works for you.
Babbayega 9 Oct, 2019 @ 6:55pm 
ok, uploaded the rig. no, its not pretty. I am a function over form kind of player. but it works, and works well.

https://gtm.steamproxy.vip/sharedfiles/filedetails/?id=1885258379