Page 1 of 19 12311 ... LastLast
Results 1 to 10 of 189

Thread: MechJeb Autom8 Scripts Megathread

  1. #1
    Junior Rocket Scientist r4m0n's Avatar
    Join Date
    Aug 2011
    Location
    Brazil, São Paulo
    Posts
    544

    Post MechJeb Autom8 Scripts Megathread

    With the release of MechJeb 1.9, the Autom8 module was finally released to the public (although in an early beta fashion).
    Now with the 1.9.1 release, things have got stable enough that a few scripts started popping up, and I've decided to create this new thread to focus on Autom8 script discussion and release.
    I'll try to keep the OP updated with links to any scripts posted here, and any documentation related to it.

    Documentation Links


    Scripts



    Using Scripts
    1. Click on the script link (I'll try to keep all scripts in pastebin for now);
    2. Click on Download;
    3. Save the script as something.lua in KSP/PluginData/mumechlib/
    4. In the Autom8 console, type: dofile("something")
    5. ???
    6. Profit!


    Sending Scripts
    Create and test your script. Reading other people scripts is a good way to see how it works in general, and the Autom8 manual should help with what you need for your specific ideas. If you can't find it on the manual, post in this thread and I'll try to clear it up, or add new functions when needed.
    With your script done, send a copy to pastebin (bonus points for using Lua coloring :p). Optionally, you could also upload a video of your script running so people can see what it does.
    With that in hand, just post a name for the script, the link to the pastebin copy and optionally a link to the video, and I'll add it to the script list.

    This thread is for Autom8 scripting discussion only, please direct any other MechJeb related discussion to the main MechJeb thread.
    Last edited by r4m0n; 9th August 2012 at 17:40.

  2. #2
    Very nice. Can you add a 'mechjeb.api' command to 'stage', like mechjeb.stage.

    The theory is that I don't want to activate/deactivate the autostage but I want to fly to a certain point, foce a stage just once (or twice) to discard a booster that still has fuel or to 'eject' a satalite into orbit, then continue on with the script?

    Nice work. I hope you're enjoying this process.

    Edit: Can you also expose the craft weight and thrust or TWR or all of it. It's available in the information screens. I'm thinking of a script that will auto-abort if a pilot tries a maneuvor that is beyond the craft capabilities. Is there a way to abort a script mid way if a disaster is detected? Lots of questions and lots of opportunities bouncing around my head.
    Last edited by togfox; 8th August 2012 at 19:46.


  3. #3
    Here's an idea, make scripts that are specifically made for certain rockets. That way if you share it in the Spacecraft Exchange, instead of having a detailed list of instructions you can just give people a demo flight.
    "Of all the words of mice and men, the saddest are, 'It might have been.'"

  4. #4
    The technology should be craft independent. A 'circularise' operation on one craft will be exactly the same for another craft, unless it is so bizarrely designed it requires odd instructions.

    I expect to see a library of common scripts accumulate in this thread so even amateurs can copy/paste the operations they need into a sequence to complete their mission profile.


  5. #5
    Quote Originally Posted by togfox View Post
    Very nice. Can you add a 'mechjeb.api' command to 'stage', like mechjeb.stage.
    Edit: Can you also expose the craft weight and thrust or TWR or all of it. It's available in the information screens.
    Is there a way to abort a script mid way if a disaster is detected?
    mechjeb.stage() works since 1.9.1, just not documented yet.
    Check the vessel.* variables in the docu: vessel.mass and vessel.thrustAvailable are what you want, they're in there.
    mechjeb.controlRelease() should stop any running Mechjeb sequence.

    Quote Originally Posted by togfox View Post
    The technology should be craft independent. A 'circularise' operation on one craft will be exactly the same for another craft, unless it is so bizarrely designed it requires odd instructions.
    I think both generic and craft-specific scripts are a good thing. Craft-specific scripts could help with ships that are hard to control, say, a heavy spaceplane that requires precise input to lift off without striking the runway or the ground - just provide a liftoff script with the plane in Spacecraft Exchange, and you don't have to teach people to fly it.

    Scripts posted in this thread should remain ship-independent, within reason of course. E.g. I'm currently working on a Buran-like space shuttle deorbit and landing program, that would obviously only work on spaceplanes that are good enough in atmospheric flight to actually make the runway.
    Last edited by olex; 8th August 2012 at 20:07.
    A programmer always has a solution. It just won't always fit the problem.

    Interactive Illustrated Interplanetary Guide and Calculator: http://kerbalspaceprogram.com/forum/...and-Calculator

    Graphotron 2000 - for Science! http://forum.kerbalspaceprogram.com/...raphotron-2000

  6. #6
    Quote Originally Posted by togfox View Post
    The technology should be craft independent. A 'circularise' operation on one craft will be exactly the same for another craft, unless it is so bizarrely designed it requires odd instructions.
    I know it is, but it's the crafts that have weird instructions that I'm talking about. You could have a craft where you fire one set of engines a few seconds before another set, but another person trying out your ship might not know that. You could use a script specially designed for that ship as a way to give instructions on how to fly it.
    "Of all the words of mice and men, the saddest are, 'It might have been.'"

  7. #7
    Cool feature. Is there a way (or will there be a way) to actually control RCS thrusters, SAS modules, etc, from the autom8 program? Then we could develop our own control algorithms for attitude control and things like that.

  8. #8
    Junior Rocket Scientist r4m0n's Avatar
    Join Date
    Aug 2011
    Location
    Brazil, São Paulo
    Posts
    544
    I'll add some way to register a callback to the drive() function in the core, so people can control things directly.

  9. #9
    Quote Originally Posted by ddavis425 View Post
    I know it is, but it's the crafts that have weird instructions that I'm talking about. You could have a craft where you fire one set of engines a few seconds before another set, but another person trying out your ship might not know that. You could use a script specially designed for that ship as a way to give instructions on how to fly it.
    But... why would you need to do that in any sane case? Mechjeb can fly almost any ship perfectly already.

  10. #10
    What am I doing wrong?

    > dofile("flymetothemun")
    Usage: FlyMeToTheMun(lat, lon)
    > flymetothemun (45,45)
    Exception: Invoke function call on non function value.
    I have the lua file in place - you can see it's loaded. My lua script is copy/pasted from wiki. ??


Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •