For you who are familiar with KSP, there is a mod called kerbalOS that let's you use a complete computer within your rockets. You can program them using a scripting language for pretty much anything.
So, why not create a such mod for SP? I've requested this last year ago but the responses were mostly "na you can use/wrtie mods"... Well yeah you can except it's not a convenient solution, it's not a solution even.
It could also be a core feature, wouldn't be so tedious to just use an existing VM and a scripting language like Lua or Python.
EDIT: I know FT is a thing, stop commenting about it.
See the edit.
With FT, you can do. Its hard, at least for me, a moron when it comes to logic and programming, but it's very very useful. Snowflake0s (iirc thats how his name is written) has a guid on it i've been using to study. For smth like KOS here, FT is your best bet.
I hate it to respond rudely but if you can't contribute something useful to the thread, simply don't comment.