Hey, so I have an idea for a project I want to work on --
I want to write a script so that everytime I push 'G', an autopilot will basically drive my ship overnight back and forth along my planet-to-planet trade route, and sell and buy my specific items automatically, and evade enemies along the route.
Is something like this possible? If so, is there any code that's already in the source that I can reference (ex. autodocking scripts, etc)?
Thanks
Writing script for 'autopilot trade runs'
Moderators: winston, another_commander
Re: Writing script for 'autopilot trade runs'
It would need core modifications to do it - at which point it's certainly possible but not easy.
There is code to apply an AI to the player ship - pressing 'c' for the docking computer activates it. So it should be possible to modify that to apply another AI. You might need to be a little careful on launch and on hyperspace exit to make sure it stayed activated.
Currently it applies one of the old plist-style AIs. Modifying it to allow a JS priority AI would probably be easier to write the AI (indeed, the existing "trader AI" would more-or-less do) but harder to write the core code modifications. (Core patches to let us use a JS AI for the player's docking computer are welcome)
The AI does only run in-flight, though, so you'd need something separate to buy and sell trade goods, select new hyperspace destination, and launch again. That could all be done with a bit of JS.
There is code to apply an AI to the player ship - pressing 'c' for the docking computer activates it. So it should be possible to modify that to apply another AI. You might need to be a little careful on launch and on hyperspace exit to make sure it stayed activated.
Currently it applies one of the old plist-style AIs. Modifying it to allow a JS priority AI would probably be easier to write the AI (indeed, the existing "trader AI" would more-or-less do) but harder to write the core code modifications. (Core patches to let us use a JS AI for the player's docking computer are welcome)
The AI does only run in-flight, though, so you'd need something separate to buy and sell trade goods, select new hyperspace destination, and launch again. That could all be done with a bit of JS.
- Norby
- ---- E L I T E ----
- Posts: 2577
- Joined: Mon May 20, 2013 9:53 pm
- Location: Budapest, Hungary (Mainly Agricultural Democracy, TL10)
- Contact:
Re: Writing script for 'autopilot trade runs'
Staying at OXP level I can imagine a long-range [wiki]ILS[/wiki] where the target station is set right after launch, plus give and keep up some velocity until docked.
Start when you press "g" is possible after some preparation: set
There is an [wiki]AI Trading Assistant[/wiki] for autotrade, but the hardest is to avoid combat due to you can not avoid it sometimes even if you are in your seat. I guess most mornings will show press space, probably need many creative ideas trying to avoid combat or at least extra fuel tanks to reduce it to every second mornings.
Start when you press "g" is possible after some preparation: set
key_fastactivate_equipment_a = "g"
in oolite.app/Resources/Config/keyconfig.plist then make a primable equipment which start the job when activated and set it to fast defensive in F4/Primable equipment/Set first fast activation (defensive). Note key_comms_log
should be set to another free key (for example "9").There is an [wiki]AI Trading Assistant[/wiki] for autotrade, but the hardest is to avoid combat due to you can not avoid it sometimes even if you are in your seat. I guess most mornings will show press space, probably need many creative ideas trying to avoid combat or at least extra fuel tanks to reduce it to every second mornings.