Space Engineers

Space Engineers

AutoLevel
150 Comments
drunken~snail 18 Jun @ 5:00am 
Hello, first of all, big thanks for this script.
Helped me out in many ways, be it in the actual game or to learn from it :)


Meanwhile it teached me that well that I grew confidence in modifying it a bit.
And due to this modification seem requested under your following folks, I thought I might upload it.


(This version accepts MouseInput to steer Left/Right)

https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=3502530334&searchtext=autolevel+slightly


Here´s the Link so you can check it out yourself.

Also feel free to grab it and upload it your own, totally fine with that.
If you do so, let me know and I´ll take mine down.
Deizelpunk 2 Feb @ 12:26pm 
Is there a way to have this script ignore yaw? It works fine to keep it level, but now i cant steer my ship yaw wise... I reserved a gyro for yaw but its fighting against the script
OK 15 Dec, 2024 @ 7:27am 
any way to prevent this from locking the rotors of sub-grids?
NerVeN 26 Oct, 2024 @ 4:03am 
On "Check Code" it crashes the game :( Any suggestions?
liquid_confidence 23 Oct, 2024 @ 7:59pm 
@Adrios is your Remote Control correctly oriented? If you roll to one side the Remote Control is probably facing upwards, meaning it was installed sideways.
Adrios 19 Oct, 2024 @ 9:22pm 
How do I adjust the angle, my ship got turned on its side?
Rocketman 24 Aug, 2024 @ 10:25am 
how do i make it auto level but with rotors?
LePapot 10 May, 2024 @ 6:05am 
Works like a charm! Thank you, been looking for a mod like this for a while
Into 21 May, 2023 @ 7:04pm 
How do I set up an angle? I need a pitch up of 16°
HackLab 12 Mar, 2023 @ 1:12pm 
Hello @Dixi Normus, @Archon!
I'm developing a flight system script that goes beyond auto leveling. I'm using your code for the alignment relative to the gravitation vector. May I have permission to publish my script, which includes your code?
Of course you will be credited as a co-author.
- HackLab
spEeͥD`eͣxͫ 29 Jan, 2023 @ 3:50am 
Weird, does level it. But overshoots and just keeps on going into that direction
red777 28 Sep, 2022 @ 11:03pm 
hi iv been testing things with this script turns out ist's amazing for mechs but for an unkown reson it only works whel with large grid mechs the small one dont works. the stcript is runing an the giroscop ar changing ther stats trying to compansat but it's like the script miss calculat the amount of force needed to balance the structur and it falls flat on the ground like nothing was stoping it. and yes iv try to chnage the parametre like indicat but no way to make it work. the potantial for that sript is amazing just need a few adjusment fo if your steel working on it plis continu it can change mech construction in the best way posible
Templar01 14 Aug, 2022 @ 6:10pm 
No sir. Did not work, Not one bit. :steamthumbsdown:

https://i.imgur.com/Ydnl0py.jpg
Cyjodev 5 Aug, 2022 @ 11:48am 
Hmm awesome script .. only problem is that it was telling me it was not finding the cockpit (not sure if I have to rename my cockpit .. and it is set at main already .. and I tried to rename at IMainshipcontroller .. and also I changed in custom the false to true ....
anvilton 14 Jun, 2022 @ 9:35am 
Like FuNkTrAiN below, getting the same error when running the script. Yes the remote control is facing forwards.

Nevermind.

Removed and rebuilt remote control and programming blocks. Edited the script as noted and ran. Worked.
Nyarlathotehp 20 May, 2022 @ 1:13am 
I'm having trouble loading the script into the block for some reason...
Nyarlathotehp 19 May, 2022 @ 10:08pm 
is the auto level script called artificial horizon? I subscribed to it and it's not on the dropdown menu...
FuNkTrAiN 18 May, 2022 @ 6:00am 
Not sure if this helps, but error I got today while trying to get it going.

Caught exception during execution of script: Unable to case object of type 'Sandbox.Game.Entities.Blocks.MyProgrammableBlock'
to
type
'Sandbox.ModAPI.Ingame.IMyRemoteControl'.

at
Program.setup[]

at Program..ctor[]
Ronin Planetary Industries 10 Mar, 2022 @ 9:10am 
This script really needs an update. Things get sketchy between game reloads. If you pick just one gyro, for example, it'll leave that gyro in override then pick another gyro if you manually re-engage the script. Speaking of, if you reload the game with AutoLevel on, it will be off on the reload. Also, using a remote control isn't necessary. You can use IMyShipController which covers remotes, flightseats, cockpits, etc.

Also, a semi-active mode would be nice. Pick a ShipController and then poll it for control input. Turn off AutoLevel, then after so many seconds of no input, reactivate the script.
Schmetterling 26 Feb, 2022 @ 4:07am 
@JackoDynamics попробуйте использовать совместно скрипт
Whip's Subgrid Gyro Manager (aka SuGMa) .

@JackoDynamics try using Whip's Subgrid Gyro Manager (aka SuGMa) script together.
Rays of Apollo 30 Jan, 2022 @ 4:03am 
@JackoDynamics It seems that gyros on subgrids cannot control the main grid, whether you override or not.
JackoDynamics 5 Nov, 2021 @ 9:26am 
I've used a rotor to add a small subgrid to my large grid ship, this small grid houses my program and timer blocks (like a central computer)

How can I make this script interact with the main ship?

I've tried using the named remote control in the script but that hasn't worked.
ChaosOrder 21 Oct, 2021 @ 6:21am 
after few mins thins script causes all my ships connected to the larger grid to disconnect from it
Gate 5 Oct, 2021 @ 12:48pm 
The refactor i posted in discussions now includes a new auto-shutoff when docked
Bugamashoo 5 Aug, 2021 @ 7:19pm 
I would also be interested in the revised script!
Schmetterling 24 Jul, 2021 @ 1:27am 
Шикарный скрипт! Прекрасная работа. Но почему, при аргументах "r", "start" или "go", скрипт ведет себя по разному? В скрипте причины не обнаружил, так как неважно с каким аргументом скрипт работает.

Awesome script! Great job. But why, with the arguments "r", "start" or "go", does the script behave differently? I did not find a reason in the script, since it does not matter what argument the script works with.
76561198042989172 8 May, 2021 @ 9:25pm 
Hi Creeper, I am interested in your revised script, would you share with me ?
CreeperInBlack 24 Jan, 2021 @ 8:34am 
You seem to read this thread, so I hope i can get to you this way. I took the liberty to work a bit on this script, changing it so that you don't need an argument and also fixed some bugs that happen if there is no gyroscope. I also implemented a Gyroscope Tag, so you can specify which gyroscopes you want to be used.

If you are interested, just add me as a friend and dm me, then I will send you the code.
Dixie Normus  [author] 23 Jan, 2021 @ 4:31am 
@CreeperInBlack the argument is a bit of legacy code but without it the script may not stop correctly (I've had issues in the past). I am going to find a way to remove the requirement for it completely but life is a bit busy right now so it'll have to wait. As for specific directions again it's something I'll look at when I update the script next. Thanks for the suggestions though!
Dixie Normus  [author] 23 Jan, 2021 @ 4:29am 
@Calmaria I'll look into that, but if you stop the script and then reduce the number it will remove the override so that is a workaround for now
CreeperInBlack 22 Jan, 2021 @ 7:12pm 
First of all, great Script. Two Points though. I don't see why it would be necessary to give an argument to start the programmable block, your code doesn't really require that. Is there a reason that you recommend doing that because for me it works fine without?
Second minor point (more of an idea really): I use the script for a bike, so I only need override in one direction, while other directions make it actively harder to drive. You could build in the possibility to stop overrides in certain directions. This is more of an edge case though.
Calmaria 7 Jan, 2021 @ 10:52am 
On the subject of Gyro selection... I thing counting the gyros on the grid, and picking 75% or them, would be the way to go, instead of the current 999. If you must have a number, you could set it to 001 instead. This is because if you run the script right off, it sets ALL they gyros to Override, and when you change it to a resonable number, its not UN-Setting that on the ones it wont be using. the 75% would also allow it to adapt to damage, if you lost half your gyros, and AL has the rest, your in trouble.
Helratz 27 Sep, 2020 @ 9:40am 
Okay thanks.
Dixie Normus  [author] 27 Sep, 2020 @ 6:01am 
@Helratz at the moment there isn't a way to do that, but adding that would be a good idea. I'm a bit busy at the moment but I'll update the script as soon as I can
Helratz 25 Sep, 2020 @ 5:52am 
Sorry to keep bothering you. Is there a way to assign specific gyros to work with the script or specific gyros to be ignored. I'm building a walker for the first time. It's very compact and I'm using a combo of modded and non-modded gyros. I just want the script to control the modded ones. Thanks.
Helratz 20 Sep, 2020 @ 2:32pm 
Okay, Thanks.
Dixie Normus  [author] 20 Sep, 2020 @ 12:07pm 
@Helratz no it shouldn't auto-run on world load. That second issue is strange though, I will have a look into it and get back to you. I have an idea of what might be causing it
Laser Dave 20 Sep, 2020 @ 6:05am 
try to recompile it occasionally, sometimes keen updates give it issues, additionally anything that messes with the time scale can mess with it pretty bad
Helratz 20 Sep, 2020 @ 5:06am 
Okay sorry to bother you again.New issue. It doesn't run automatically on world load. Has to be engaged manually. Right? Well unless I open the "edit" tab in the PB first, the temp gyro override option won't work. I have it set to "true". It will level the ship when I first manually engage it. However if I don't open the "edit" tab first that option will not work. Thoughts? Thanks.
Dixie Normus  [author] 17 Sep, 2020 @ 11:24am 
No worries, glad to hear it's working!
Helratz 17 Sep, 2020 @ 11:21am 
You know what. I did the "REMOTE_CONTROL_NAME" thing and it seems to be fine now. My mistake. Thanks.
Dixie Normus  [author] 17 Sep, 2020 @ 10:19am 
@Helratz I will have a look but that shouldn't be the case
Helratz 17 Sep, 2020 @ 7:58am 
Seems like it crashes when ever I change something on my ship. Even a simple name change of a block stops it dead and an exception pops up.
Laser Dave 31 May, 2020 @ 6:12pm 
@solraven, absolutely, you'd just have to adjust how quickly the script corrects its orientation until you got it at the right level, make sure to always have at least one gyro that isnt in the action group for autolevel otherwise you wont turn
Dixie Normus  [author] 31 May, 2020 @ 3:14am 
@Solraven I've never tried it but I don't see why not
Solraven 31 May, 2020 @ 12:21am 
at that point couldn't you drive it like a car and it just stay up straight or is the reaction time to slow? i mean in theory you could make a unicycle right?
Dixie Normus  [author] 14 May, 2020 @ 1:21pm 
@Suckeychicken the script doesn't interact at all with pistons or rotors at all so I'm not sure there's much I can do about that, if you can find a way to reproduce it then let me know and I'll have a look into it. Glad it solved your initial issue though!
Laser Dave 14 May, 2020 @ 11:15am 
that does appear to have solved the initial issue, not sure how to replicate the piston issue properly as it only rarely happened
Laser Dave 14 May, 2020 @ 10:54am 
i also noticed an issue, where pistons and rotors were turning independently and it was causing some strange tearing to occur, not sure if this is the same issue or a separate on but it certainly makes for an interesting time.