Space Engineers

Space Engineers

Automatic Door Close
44 Comments
Valykino 15 Aug, 2023 @ 8:22am 
i can't get it to work i have put "AutoClose" in every name but it still doesnt work
rafikiman 29 Apr, 2021 @ 8:11pm 
After you make the corrections to the code, you have to manually start the timer block once its setup and it works perfectly!
Boomheadshotoverkill 25 Mar, 2021 @ 8:37am 
I put the edit's in like Risa said and the script still won't work. Looking for help because I very much like this mod and am said that it is currently not working for me.
{H.K.}Warlama 21 Dec, 2020 @ 11:45am 
EDIT: for some reason after compiling i rechecked everything for errors.
for some reason the programmable block got shut off. not sure how it happened.
i turned it back on and the script appears to be working again??.
I wont question it, i will accept it though.

I will repost if i find other errors.
{H.K.}Warlama 21 Dec, 2020 @ 11:24am 
tried using the script after a long time away. made the fixes to lines 59 and 184.
recompiled the script with no errors, yet the script wont run
Ghost Wolf 27 Jul, 2020 @ 5:01am 
when i try compile it gives me an error
Kakskjiv 15 Jun, 2020 @ 12:03pm 
one questin, I want the door to close slightly faster, but wriiting in 0,5 or 0.5 fives me an error. I'm no coder so I wonder if 1/2 of a second shuld be written differently?
Zoc 1 Apr, 2020 @ 3:44am 
This works perfect. Always wanted a proper 'all' door closing script.
Nice work.
br8den 15 Feb, 2020 @ 2:30pm 
This script is a pure delight. One operating brain to run all my door behaviors. Thank you. And thank you Risa Koizumi for the edit.
Utburd 13 Apr, 2019 @ 1:15pm 
Thanks for the fix, @Risa Koizumi !
dark_mift 23 Jul, 2018 @ 9:08am 
Script is no longer viable
classicpark 2 May, 2018 @ 10:43am 
Why the creator is not updating this script its a cool script
Risa Koizumi 1 Jan, 2018 @ 2:07am 
Capitalization counts! :)

For those trying to mod this script and getting context errors, the lines that need changing are line 59 and 184. Change these from:
if (doorblock.open)
to:
if (DoorBlock.Status == DoorStatus.Open)
Press "Remember and Exit" and then Recompile.

This will fix this script and it will work as it should.

And as a tip, if you rename your doors after recompiling, even from "AutoClose_Door" to "AutoClose_DoorA" or to "Door [AutoClose]" (all of which will work) remember to recompile again, or the script will completely stop functioning. Have fun!
Addicted2Breathing 3 Oct, 2017 @ 4:58pm 
@Chara I tried your fix but now I am getting the error: The name 'Doorblock' does not exist in the current context
any chance you can lean on your friend to figure out what else they did to fix the code?
Chara 13 May, 2017 @ 10:40pm 
If it helps and for those of you who like this script, take the lines 59 and 183 i think it was, and change the (doorblock.open) to (Doorblock.Status == DoorStatus.Open). should work again.
At least it did for me after my friend fixed the coding on those two obsolete lines. Cant help further than tell you what he did for me.
pyr0kid 27 Feb, 2017 @ 8:33pm 
so what, this doesnt work anymore?
Kaiash 13 Feb, 2017 @ 8:17am 
it tells me iMydoor.Open is Obsolete
DMMWolf 13 Feb, 2017 @ 8:15am 
was just going to comment about obsolete commands but someone beat me to it
HachiiCatt 6 Feb, 2017 @ 5:40pm 
getting some obsolete errors
{H.K.}Warlama 26 Dec, 2016 @ 12:34pm 
thank you for this script. i just tried it, i followed the instructions then i sat waiting for a door to auto close....and it worked. this is wonderful friend. much love and respect to you. well done!
Bradster2214 10 Sep, 2016 @ 5:35pm 
(Reply to my last comment)
never mind, i reset the timer block's 1st function and changed it to run with default script then back and it works fine now. THANK YOU SO MUCH KIND SIR :P
Bradster2214 10 Sep, 2016 @ 5:32pm 
My doors do not close had i have them named accordingly:
AutoClose_outer_left
AutoClose_outer_right
AutoClose_inner_left
AutoClose_inner_right
i have the timer block's actions set correctly, and the delay set to 1, and yes the ship has power
Vas 21 Aug, 2016 @ 8:08pm 
Oh and another good thing you could do, is have doors with set auto close frequencies. [AutoClose:1] [Autoclose:5] (1 second or 5 seconds), like the cargo sort script does with its modifiers and such.
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=321588701
Vas 19 Aug, 2016 @ 6:58pm 
A better method that could conserve some CPU power, is if you have the script automatically close doors each time the script is run, then you can have the timer set to run every 2-5 seconds and it will close doors when the timer clicks on. However, this could coincidently happen the instant you try to open a door if the script is run at that time, so. It was just a thought.
Galactus 16 Aug, 2016 @ 10:56pm 
One of my doors wont close Automatically, it is only one though. The line is in the name and everything.
Dancing Bastard 30 Jun, 2016 @ 3:10pm 
Hello friend, I can't seem to get it work. Would you please go into more details as to where place the blocks and stuff like that? Here's how I've set it up and it doesn't work - I don't know how should it open since I don't have any sensors to sense me coming. And...what's the "argument" I get when I link the programmable block into the timer actions?

Here are some screenshots of my setup on creative:
https://gyazo.com/e4098b2e7d7b12352d142d1fc2d10835 <- door name
https://gyazo.com/a6afd066a4c791d4e50461eecc975000 <- timer actions (run/start)
https://gyazo.com/55fa4b058597c7231437ea8ae2f736be <- how it looks from the side.

The door won't open. No idea why, appreciate any help:) Thanks!
⎠Byte™⎝ 11 May, 2016 @ 8:14am 
great script ;)
Cherubiel 10 Feb, 2016 @ 2:15pm 
Doesn't close doors >_<
Maybe its the sliding doors I'm using this for?
Majky 3 Nov, 2015 @ 11:22am 
Superb script..
I cant do programing/scripting... is it hard ? I would like to have a script to my borg cube.
Problem : The borg cube have many hundreds of welders. And when they are turned on the sim speed goes down to 0.25 (or something like that)
My desire : Have a script that turns on maby 40 welders for a couple of seconds and then turn them off and then turn the next 40 welders on for a couple of seconds and so on...
Is that something you could do ?
EvilMatt 16 Jul, 2015 @ 6:11pm 
Has anyone else been able to get this working on a dedicated server? I have everything set up right. Maybe the server needs a restart?
bady89 1 Jul, 2015 @ 11:28am 
NICE !!!
Mexican Dave  [author] 5 Apr, 2015 @ 9:59am 
Hey guys. Sorry for the delay! I have updated the script, it now ignores any doors that don't contain "AutoClose" in the name, so you can set which doors are automatically closed. There are more details in the script so give it a quick read.

Could somebody let me know that the script updated fine, this is my first time updating a workshop item and i want to make sure it all went smoothly.
MaverickSawyer 3 Apr, 2015 @ 8:16pm 
Overall, a nice bit of coding. However, as others have noted, it doesn't have a way to mark something to be left alonne. It causes the Stargates in the the Stargate mod pack to close after two seconds... not really ideal for moving lots of people or stuff through it.
Larynx 29 Mar, 2015 @ 12:11am 
yes, that would be nice. I think the best way is, to use a prefix (all doors with prefix will close automatic)
Mexican Dave  [author] 28 Mar, 2015 @ 12:53pm 
I will take a look at having it ignore hangar doors, or putting some switch to ignore them. Il get an update up sometime around tomorrow evening.
Darth Biomech 28 Mar, 2015 @ 12:10pm 
I gor a bug report: this script react to hangar doors too.
Λtom 27 Mar, 2015 @ 10:24pm 
Love this script, simple and effective. Any way to exclude certain doors or types of doors? (i.e. personnel doors vs. hangar doors)
Darth Biomech 10 Feb, 2015 @ 4:21am 
Wonderful, thanks!
Mexican Dave  [author] 19 Jan, 2015 @ 2:14am 
Well thats an easy fix :).

For future reference for yourself any anyone else who has a similar issue, when you add a door and the game automatically names it the same as another door that is already on your ship, just renaming the door wont fix the new door not closing. Once you have renamed the door, open up the programmable block code editor and press 'Rembmber & Exit', and the scripts list of doors will reset and all should be working fine.
CPT Haddock 18 Jan, 2015 @ 1:14pm 
yeah, I had probably just named it the same thing as some other door
Mexican Dave  [author] 17 Jan, 2015 @ 6:01pm 
Glad you got it working. I wouldn't have been able to help much, i have uninstalled all of the mods i was using to check out the new stuff the devs have added (not played the game in about 6 months), so its currently untested. Providing any modded doors are the same 'type' as the default doors in the script engine, it should work fine.
CPT Haddock 17 Jan, 2015 @ 9:36am 
uhm, nvm. all of a sudden the modded doors decided to co-operate. thnx for a great script
CPT Haddock 17 Jan, 2015 @ 9:32am 
´Very nice script, sir. but im having trouble getting it to work with modded doors. And no, i do not know the first thing about scripting. but any help is appreciated.