Space Engineers

Space Engineers

AutoLevel
149 Comments
Deizelpunk Feb 2 @ 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 Dec 15, 2024 @ 7:27am 
any way to prevent this from locking the rotors of sub-grids?
NerVeN Oct 26, 2024 @ 4:03am 
On "Check Code" it crashes the game :( Any suggestions?
liquid_confidence Oct 23, 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 Oct 19, 2024 @ 9:22pm 
How do I adjust the angle, my ship got turned on its side?
Rocketman Aug 24, 2024 @ 10:25am 
how do i make it auto level but with rotors?
LePapot May 10, 2024 @ 6:05am 
Works like a charm! Thank you, been looking for a mod like this for a while
Into May 21, 2023 @ 7:04pm 
How do I set up an angle? I need a pitch up of 16°
HackLab Mar 12, 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ͫ Jan 29, 2023 @ 3:50am 
Weird, does level it. But overshoots and just keeps on going into that direction
red777 Sep 28, 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 Aug 14, 2022 @ 6:10pm 
No sir. Did not work, Not one bit. :steamthumbsdown:

https://i.imgur.com/Ydnl0py.jpg
Cyjodev Aug 5, 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 Jun 14, 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 May 20, 2022 @ 1:13am 
I'm having trouble loading the script into the block for some reason...
Nyarlathotehp May 19, 2022 @ 10:08pm 
is the auto level script called artificial horizon? I subscribed to it and it's not on the dropdown menu...
FuNkTrAiN May 18, 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 Mar 10, 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 Feb 26, 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 Jan 30, 2022 @ 4:03am 
@JackoDynamics It seems that gyros on subgrids cannot control the main grid, whether you override or not.
JackoDynamics Nov 5, 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 Oct 21, 2021 @ 6:21am 
after few mins thins script causes all my ships connected to the larger grid to disconnect from it
Gate Oct 5, 2021 @ 12:48pm 
The refactor i posted in discussions now includes a new auto-shutoff when docked
Bugamashoo Aug 5, 2021 @ 7:19pm 
I would also be interested in the revised script!
Schmetterling Jul 24, 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.
Ronchi May 8, 2021 @ 9:25pm 
Hi Creeper, I am interested in your revised script, would you share with me ?
CreeperInBlack Jan 24, 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] Jan 23, 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] Jan 23, 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 Jan 22, 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 Jan 7, 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 Sep 27, 2020 @ 9:40am 
Okay thanks.
Dixie Normus  [author] Sep 27, 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 Sep 25, 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 Sep 20, 2020 @ 2:32pm 
Okay, Thanks.
Dixie Normus  [author] Sep 20, 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
Suckeychicken Sep 20, 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 Sep 20, 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] Sep 17, 2020 @ 11:24am 
No worries, glad to hear it's working!
Helratz Sep 17, 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] Sep 17, 2020 @ 10:19am 
@Helratz I will have a look but that shouldn't be the case
Helratz Sep 17, 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.
Suckeychicken May 31, 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] May 31, 2020 @ 3:14am 
@Solraven I've never tried it but I don't see why not
Solraven May 31, 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] May 14, 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!
Suckeychicken May 14, 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
Suckeychicken May 14, 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.
Suckeychicken May 14, 2020 @ 10:52am 
ill give it a try!