Space Engineers

Space Engineers

Spug's Easy Auto-Docking 2
862 Comments
Reigdaer Jun 24 @ 8:35pm 
hi there i notice that some of my ships keeps the thruster overwrite from the script after they dock, it does not happens to al ships, but those ships who has that "bug", always have the same issue
Sined May 23 @ 10:57pm 
Hello!
Strange... I installed two programmable blocks, loaded the script twice into each. I wrote down the ToBase route for the first one, and the ToMine route for the second one.
I launch ToBase or ToMine, the ship flies to the last recorded dock. Apparently something broke in the game.
HeWhoTypes May 14 @ 9:58pm 
Question. I got this to work on a small grid ship, can't get it to work on the large grid ship, set it up the same as i did on the small grid. not sure what i am doing wrong. Does this work on large grid ships?
Zac May 11 @ 1:49pm 
When I run this on a PB on the ship it says docking location saved, but as soon as I unlock the connector "run" on the PB is greyed out?
(_KsR_) Mar 10 @ 2:19am 
Это выглядит очень мило
Gromit Mar 5 @ 8:22am 
Hi @Spug, I noticed an incompatibility problem with the newly released AQD - Airlock Connectors . I recreated an empty world with only this mod and used your script to record the docking location and when I try to auto-dock the 2 large 3x3 connectors won't connect, there's a gap of a little bit less than a block between them. It's however possible to complete the docking operation manually, just giving the last "punch" to dock. Any idea where this could come from and what could be adjusted to make it work (if possible) ?
Thanks :se:
MERLIN Feb 10 @ 8:19am 
Tell me, please, does this script only work for docking pads in open terrain? I have a hangar on my mothership, and the drone should fly into its entrance. However, the drone rests against the wall of the hangar.
LootGoblin Nov 26, 2024 @ 8:02pm 
@Spug the video tut is no longer available, you might want to kick it out off from your Extra Info section, if you ever read this -.-
LootGoblin Nov 26, 2024 @ 8:00pm 
@The_Bum_Dave
Probably the same issue like "Not Returning to Player control after Docking" in the discussion section. Unfortunately this is a thing since ages.
The_Bum_Dave Nov 13, 2024 @ 8:25am 
When I disconnect from a connector I have to recompile the script to regain manual control.
LucaZanna Nov 3, 2024 @ 10:20pm 
Hi, I have a connector attached to a piston. I'm either missing something or it's not possible to auto dock thought a piston>connector=connector<ship(main grid)
Gromit Oct 31, 2024 @ 8:13pm 
@MetalGodX: it's a script, not a mod. It must not be loaded in the mods list for your world but from programmable blocks.
Hope this helps
MetalGodX Oct 31, 2024 @ 4:45pm 
Does this mod still work? I get an error when I load into my server. Says "Some mods were not loaded because of errors"
URDADSBOYFRIEND Oct 22, 2024 @ 4:12pm 
Does it work with gravity drive?
Martin Rayleigh Oct 18, 2024 @ 6:15am 
Is there a command/argument to stop/cancel a docking sequence ?
Cerberusska 凸(^_^)凸 Oct 5, 2024 @ 2:28pm 
not working with modded Thursters :/
Misha Aug 23, 2024 @ 4:03am 
does it work with Relative GPS?
I'm working on something like that. But, it's complicated script like you. It need alot time.
I using two scripts: one script send GPS by Antenna, second ready and AutoDocking.
My script can park in hig-velocity. But I have not complite yet.
I see you have done it.
So, should I continue my? can your ship dock to the moving ship?
phfor Aug 12, 2024 @ 11:38pm 
That's because it's a script, not a mod, Barz
Barz Aug 8, 2024 @ 4:58pm 
The mod does not appear in the mod selection in the main menu
Grog Jul 24, 2024 @ 2:55pm 
Should look at PAM (path auto miner) which is also a cargo automation between 2 connectors.
Rage Jul 23, 2024 @ 8:10pm 
Is there a way to automate this with timer blocks? I was looking to make an auto cargo drone to ferry ice from my mining rig to my base, but whenever I trigger the programable block via a timer block, it doesn't run, and I then have to recompile the script before I can trigger it manually.
Reigdaer Jul 2, 2024 @ 8:30pm 
just to let you know, if you use event blocks, not set them to auto charge batteries, the thruster dont get reset after you connect and the next time you disconect, you are going to fly away randomly
HaVoCxCoBrA May 25, 2024 @ 12:49pm 
Hey, just downloaded the program, heard good things about it. But I can't get it to work with ships that have modded thrusters.
Come and See May 8, 2024 @ 2:55pm 
I figured it out. You just run the same argument twice. So I run basedock into the argument field and it saves it then I run it again. Also, make sure the custom data is completely wiped out on the program block. The script wasn't working properly for me because my PB had custom data from another script.
Come and See May 6, 2024 @ 7:17pm 
How do you even use this script? There's literally no videos/tutorials and it just says "press Run with a particular argument" ... what is the particular argument?
nalog_15 Apr 12, 2024 @ 9:23pm 
Gods bless you! After whole night fighting with AI blocks Ive found holy grail🖤 thank you🤗
Darth Porgus Mar 11, 2024 @ 4:20pm 
Can you use this script in conjunction with PAM to create faster and more reliable docking, while still using the PAM script or a other script to automate the mining process? If so, how can you achieve that?
Jogador Pedrão Mar 9, 2024 @ 4:07pm 
Does this still work?
DigitalContent Feb 11, 2024 @ 10:06pm 
*FIXED*
To Remove known locations , run an argument "clear" + name of location

i had to look that the source code as it's not stated anywhere
DigitalContent Feb 11, 2024 @ 9:08pm 
Is there a way to clear all docking locations ?
Stollie Jan 12, 2024 @ 8:00am 
@Gromit, Thanks mate, its all good, I ended up writing my own code to fly to a waypoint above the connector with collision avoidance on and precision mode using the remote control then calling this script from that script once it arrives to land, works pretty well :)
Gromit Jan 3, 2024 @ 10:53am 
@Stollie: try editing the script and change the value of "connector_clearance" (don't forget to recompile). This should solve your problem :se:
Stollie Jan 3, 2024 @ 9:30am 
Hey Spug, is there a way to make them go to a certain point above the connector before descending without waypoints?

I'm finding when I move the carrier ship they can end up ramming into it before getting to the connector.
Stollie Jan 2, 2024 @ 8:11am 
Oh never mind I figured it out, you need to recompile AFTER adding the tags, it doesn't do a dynamic search?
Stollie Jan 2, 2024 @ 7:26am 
Hi Spug, I'm having issues with [start dock], I have a timer on my ship called "[start dock] - Drone1" and its not triggering when I start docking, otherwise ship docks just fine.

Anything obvious I'm doing wrong?
Merii Dec 5, 2023 @ 7:21pm 
Is there a way to handle the connectors by name instead of entity ID? I'm on a server and hangaring/unhangaring a grid means that the entity ID or something changes which means I need to set the docking location up every single time I log on.
Axlion Dec 3, 2023 @ 4:25am 
Instructions unclear, block just keeps saving the location to dock at by the argument name. Might be partly because the docking instructions say "press Run with a particular argument" without saying what the particular argument is. Also I have multiple connectors but am trying to use just one with this, the program maybe mistaking the small ship I have docked as the one I'm trying to save the location of.
:D Nov 29, 2023 @ 7:25pm 
Bro i love you thx alot!!!!!!!!!!!!!!
Unruly Sep 28, 2023 @ 10:55am 
So, spug seems to lose the recorded parking spots every time a server reboots? The custom data still has that inscrutable large integer, but when I hit the shortcut for a previously recorded connector, it records the current position as a new spot.
Unruly Sep 24, 2023 @ 2:25pm 
@R3p1c: is it possible the ship you are trying to make dock has a smaller ship currently docked to it? I was having the same thing, then remembered I have a miner docked inside. I added '[recall dock]' to the connector it (the small miner) uses and recompiled spug and it started acting properly.
BlazingImp77151 Sep 14, 2023 @ 1:28pm 
Thanks, folks!
SileniusFF Sep 14, 2023 @ 7:38am 
@BlazingImp77151 I also recommend using this script for docking instead of AI blocks. Easier to set up, flexible and very reliable. I usually let AI blocks handle "return to base flight" and then run Docking PB.
Gromit Sep 14, 2023 @ 7:07am 
@BlazingImp77151: I confirm it still works and is easier to use than the AI blocks. It has also much more options you can easily configure. Try it and you'll see you can't play anymore without it :se:
Spug  [author] Sep 14, 2023 @ 6:49am 
It should still work @BlazingImp
BlazingImp77151 Sep 10, 2023 @ 4:00am 
Do these scripts still work? Is it better or worse than figuring stuff out with the AI blocks?
Grog Aug 23, 2023 @ 12:05pm 
It is stored in the storage variable.

https://spaceengineerswiki.com/Programming_Guide

"All variables, local and global except for the built-in Storage variable will lose their value or return to their default value when recompiling the code and between saved game loads. The Storage variable is unique in that it will store the data as a string for use between saved sessions and recompile."
KuroShiro Aug 23, 2023 @ 12:20am 
where are the dock names stored? Custom date seems to get wiped on the server Im playing on when a ship is hangar-ed. I'm looking where its stored so I can back it up somewhere to paste it again after un-hangar-ing. Backing up the numbers generated from custom data of the PB block doesnt seem to solve it
liquid_confidence Aug 19, 2023 @ 4:00pm 
Has anyone used the timer names? I have [dock] in my timer name, on the ship: SPUG timer [dock] However this timer never activated after the ship successfully docks.
Any ideas?
GrumpyMunkyIndy Aug 16, 2023 @ 11:12am 
Quick Question: In the description you mention running the code with argument 'Docking name' while docked to save that location and rotation. But the next bit i find a little confusing where you say 'To dock, if you press Run with a particular argument, it will fly and land at that saved location.'
What IS that particular arguement? The name of the saved location? Does it only save locations while docked and return to them while Undocked and I simply use the same name IE Landing Pad One to BOTH Save AND Recall?
Grog Aug 9, 2023 @ 8:09am 
Hi,
I have just added the reset all option to the script, sorry Spug for the alteration of the good work ;)

So basically:
1. open the script in the PB script editor as usual
2. copy the script in a text editor (notepad++, or other)
3. go to line 124
4. replace the full line by:
UpdateType ɼ){ɻ+=1;if(Z.ToLower().Trim() == "reset docks"){Storage="";Z="";ǵ.Clear();Echo("Docking points reset done.");return;}if(Z.ToLower().Trim() == "reset docks"){Storage="";Z="";ǵ.Clear();Echo("Docking points reset done.");return;}if((ɼ&(UpdateType.Update1|UpdateType.Once|UpdateType.IGC))==0){if(Ȅ){if(Z.ToLower().Trim()==

5. copy back the full code into space engineer PB script editor
6. check code, it's done

To reset stored docking point (clear all): run the PB with argument " reset docks ".
If you use the additional UI script running in another PB, you'll need to recompile the UI PB.