Jump to content

MechJeb Autom8 Scripts Megathread


r4m0n

Recommended Posts

I absolutely love this Autom8 stuff. Here's a thrown together script to get you to Duna. Not sure if it will work...


--
-- To Duna by B25Mitch
-- Version 1.0
--
-- for MechJeb 1.9.3
--
--------------------------------------------------------
-- Usage: * save to KSP/PluginData/mumechlib/toduna.lua
-- * in game, open autom8
-- * enter: dofile("toduna.lua")
-- * and follow the instructions.
--------------------------------------------------------

function ToDunaDriver(lat, lon)

print "Launching..."
mechjeb.launchTo(125000, 0)
wait(mechjeb.free)
mechjeb.autoStageActivate()

print "Changing Apoapsis to outside Kerbin SoI"
mechjeb.changeAp(90000000)
wait(mechjeb.free)

print "Warping to SoI"
mechjeb.warpToEvent("SoI", 30)
wait(mechjeb.free)

print "Circularizing orbit."
mechjeb.circularize()
wait(mechjeb.free)

print "Transferring to Duna"
mechjeb.transfer("Duna", 200000)
wait(mechjeb.free)

print "Circularizing Orbit."
mechjeb.circularize()
wait(mechjeb.free)

print "Landing..."
if (lat == nil or lon == nil) then
mechjeb.landAt(0, 0)
else
mechjeb.landAt(lat, lon)
end
wait(mechjeb.free)
mechjeb.autoStageDeactivate()
print "Landed!"
end

function ToDuna(lat, lon)
local co = coroutine.create(ToDunaDriver)
coroutine.resume(co, lat, lon)
end

print "Usage: ToDuna(lat, lon)"

i think i may have fixed it

i'm testing it right now

--
-- To Duna by B25Mitch
-- Remastered by Kickguy223
-- Version 1.0 Remastered
--
-- for MechJeb 1.9.3
--
--------------------------------------------------------
-- Usage: * save to KSP/PluginData/mumechlib/toduna.lua
-- * in game, open autom8
-- * enter: dofile("toduna.lua")
-- * and follow the instructions.
--------------------------------------------------------

function ToDunaDriver(lat, lon)

print "Launching..."
mechjeb.launchTo(125000, 0)
wait(mechjeb.free)
mechjeb.autoStageActivate()

print "Changing Apoapsis to outside Kerbin SoI"
mechjeb.changeAp(90000000)
wait(mechjeb.free)

print "Warping to SoI"
mechjeb.warpToEvent("SoI", 30)
wait(mechjeb.free)

print "Circularizing orbit."
mechjeb.circularize()
wait(mechjeb.free)

print "Transferring to Duna"
mechjeb.transfer("Duna", 200000)
wait(mechjeb.free)

print "Warping to SoI (again)"
mechjeb.warpToEvent("SoI", 30)
wait(mechjeb.free)

print "Changing Ap and Pe To 234 "
mechjeb.changeApAndPe(234, 234)
wait(mechjeb.free)

print "Circularizing Orbit."
mechjeb.circularize()
wait(mechjeb.free)

print "Landing..."
if (lat == nil or lon == nil) then
mechjeb.landAt(0, 0)
else
mechjeb.landAt(lat, lon)
end
wait(mechjeb.free)
mechjeb.autoStageDeactivate()
print "Landed!"
end

function ToDuna(lat, lon)
local co = coroutine.create(ToDunaDriver)
coroutine.resume(co, lat, lon)
end

print "Usage: ToDuna(lat, lon)"

i left your things in there because all i'm doing is fixing it (i have no experience with Lua, so this is a feat for me)

Link to comment
Share on other sites

i think i may have fixed it

i'm testing it right now

i left your things in there because all i'm doing is fixing it (i have no experience with Lua, so this is a feat for me)

It bounces back in to kerbin Soi for a little which messes up the whole sequence

currently end result an attempted solar landing

a check statment as to what body jeb is orbiting should be possible right?

nope maybe not

does anyone know how the new version of the protracter mod gets its closest approach calculation?

that would make a brute force lowering pe course to eve possible

Link to comment
Share on other sites

  • 5 months later...
  • 2 weeks later...
Using Scripts

4. In the Autom8 console, type: dofile("something")

It doesn't list in the OP or in the linked wiki page how to access the Autom8 console.

Had a bit of a look around and a google, but not immediately apparent.

Also, the link to the main mechjeb thread is broken.

Link to comment
Share on other sites

  • 3 weeks later...
But... why would you need to do that in any sane case? Mechjeb can fly almost any ship perfectly already.

But mechjeb won't fire a set of engines separately if needed, mechjeb only fires what is in the current stage.

Link to comment
Share on other sites

General question:

Does this only work for the currently active, controlled craft? If so:

I always wondered why there are no popular addons that allow to create automated drones etc that could continue functioning while not player controlled.

I know about the fact that non-controlled vehicles stop working in some aspects as soon as the player switches to another craft. Does this prevent what i suggested, without any possible way to circumvent?

Link to comment
Share on other sites

I have a minor request for a mechjeb coding addition: Would it be possible for the "Orbit Info" or "Landing Autopilot" or perhaps "Surface Info" to include a Re-entry angle computation? This would make it much easier to plan realistic re-entry manuevers and use add-ons such as Deadly Re-entry. If this is already in the code, my apologies, I haven't seen it.

If you really wanted to take it to the next level, a Re-entry Autopilot would be handy.

Thanks for what you do, Mechjeb definitely helps me automate a lot of things. Having played Orbiter for years on end, I can tell you hat this sort of computational assistance is very useful.

Link to comment
Share on other sites

Currently yes, but it's coming back.

Could you do it scriptless? Just record/replay options selected in the node planner, with the possible option of setting a fixed target or target via dialog. I'm a programmer but I never got into autom8 because I couldn't be bothered to learn the commands.

Link to comment
Share on other sites

  • 2 weeks later...
How do I use the Spaceplane lander with the current v2 version??

You wait in orbit until the code for Autom8 2.0 is finished? :cool:

I'm another one who really needs Autom8 for my project. But with the way MJ2 has improved I can only guess that the new Autom8 is going to be awesome.

Link to comment
Share on other sites

Could you do it scriptless? Just record/replay options selected in the node planner, with the possible option of setting a fixed target or target via dialog. I'm a programmer but I never got into autom8 because I couldn't be bothered to learn the commands.

That would prevent the script from making any decisions based on what's happening during the flight, much less flexible

Link to comment
Share on other sites

  • 1 year later...
  • 5 months later...
  • 7 months later...

Is there a current alternative to Autom8?

I'm making a system and I don't want to EVER have to use a mouse during flight.

Currently trying to find a way to talk to MechJeb, but I'm having a ton of trouble. If I can see a working example I can get something that will work.

Hopefully this isn't dead. It looks really cool.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...