[SCR] OK Traders v1.7.1 (04-12-14)

The place to discuss scripting and game modifications for X³: Terran Conflict and X³: Albion Prelude.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

Post Reply
Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod » Tue, 14. May 13, 23:23

I fancied freight drones on the TL transfers for in-sector visuals, based on a video I saw recently (don't recall if it was elite, rebirth or star citizen) showing drones unloading a cargo ship. I'd like to see an orderly stream of drones flying out to the station and another stream coming back. Perhaps uniformity of flight paths could be effected by disabling collision detection, it's something I'd need to experiment with.

I suspect simulating the ware exchange would still have to underpin the drones though. If each drone were to conduct a real miniature transaction, then the stock level and therefore price would continually rise or fall rather than the bulk transaction occurring at a fixed price.

User avatar
joelR
Posts: 2008
Joined: Mon, 9. Jul 07, 23:33
x3tc

Post by joelR » Wed, 15. May 13, 00:01

Thats a great idea. It would make freight drones actually useful.

Vayde
Posts: 850
Joined: Fri, 6. Feb 04, 21:02
x3tc

Post by Vayde » Wed, 15. May 13, 22:45

Testing set up. 5.2 AP with the jump start script to set a few things in motion and help with start up. Starting sector Argon Prime.

So we have 2 1mj shield fabs in Argon Prime about 3k apart. 2 Mercury's fully tricked out, max shield rudder speed and 4k cargo with jump drives.

1 set as an OK Trader the other as a default CAG, no adjustments. Each assigned and home based to their own Fabs. Each fab left at default pricing and given 1 mil creds.

Jump range on mercs and stations set to 2. 2 sector exploration range of Argon Prime with no sat placement.

And they're off.

The OK trader was off like a shot and had his fab filled and producing really fast, the CAG just trundled off to its first station as he has no jump ability yet.

The OK trader was the first to start and sell products to the Argon eq dock. on avg he would sell 24 to 36 shields at a time.

We are now 6 seta hours into the test.

The CAG is catching up, one more training and he will have jump drive ability. It's at this point with 144 shields in his fab he decides to sell for the first time, netting a huge amount and almost catching the OK trader for profit.

Another 6 hours on seta 10 and the CAG pilot is more than holding his own. Profit for both fabs is about 600k with the OK Trader just edging it.

It's at this point that the CAG pilot takes his last training and his brain shuts down. He starts jumping for goods but does not have the fuel to return so ends up flying the whole way back.

Mr OK trader does not have a complicated algorithm slowing him up so he pushes ahead.

We are now 18 seta hours into the test.

The CAG pilot has found his idiots guide to piloting a ship and is putting it to good use, if he is beaten to a trade by an NPC he finds another place to buy. Unfortunately for the OK Trader he seems to be continuing his flight and buying at a higher rate. His station is always producing and is never short of wares.

Now the result of this test shows me that there is not a lot to choose between these two scripts. I deliberately did not adjust any CAG features to just be able to get a comparison. Although with a few seconds of tweaking the CAG at the start, his profit margins would have been better.

However as an afterthought, I should have ran a fully trained CAG against the OK trader to give them both an Equal start. I might do this another time.

As I've only ran this on a simple basis using a single fab with 1 product and 3 resources, I can't possibly know how this test would work with a larger complex and intermediate goods.

I'm neither Pro OK Trader or CAG, I was just curious as to how they would perform against each other. The information I have given here is by no means definitive and is not intended as a guide or a preference of one script over another.


Vayde
Still life in the old dog yet...

Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod » Thu, 16. May 13, 00:25

Nice review, thanks Vayde.

In my case I've got 15 traders working a quad XL laser complex and they're keeping pace all right. It stocks something like a billion energy, and if energy isn't filled at a high rate only 1 type of laser ever starts building at a time. Was impossible with default trade scripts. I've dedicated 1 OK trader as a seller though as the energy reserve is taking so long to build that it's otherwise always a higher priority than the products, which annoyingly build in batches of 50 out of 80 so won't actually fill up unless sold off.

I've got 4 of them working a teladianium complex, taking over from 4 vanilla traders. They've really turned that thing around, it's now fully stocked with energy with product barely sitting there for long. 2 can probably manage it.

Being able to exploit infinite laser buying EQ docks makes a big difference to my complex. Without this I was only trading 1 PPC at a time, since the trader would otherwise factor in 'free amount of ware' in dest station to the amount it would load up. I noticed the vanilla selling script would load a bunch of PPC, but sell only 1 of them, so it would come back with most of them still in cargo. Would be interesting to know how CAG detects and handles selling to infinite buyers, I used a somewhat creative method to solve that. This is in XTC btw, haven't checked it on vanilla/XRM/AP. The way I see it, if the player is able to exploit that, then it's fair game for the trader automation to exploit it too.

In terms of forthcoming changes I'm adding a monitor task that scans for incoming hostiles so the trader can jump to safety before being attacked. I'll also make this task monitor the target station's price and divert or return home for refuelling, to optimize away that trouble your analysis highlights.

If there are any other low-cost high-payoff optimizations that spring to mind do let me know.
- Sell multiple wares in 1 go in the target sector if price is ok. Wouldn't be trivial to implement and this doesn't seem likely to gain much in the majority of cases.
- Don't return home empty after a sale, if a bought ware in local sector is highest priority for the homebase and within cost. Should be straightfoward and occasionally worthwhile.

Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod » Thu, 16. May 13, 22:56

I discovered there's a command conflict with Station Financial Manager. Trade cmd id 42 appeared unoccupied but there's a duplicate entry in the reservation table which is in use. I'm going to switch the command id to 48 in the next patch.

Code: Select all

<t id="441">COMMAND_TYPE_TRADE_41</t> : UTProfit - UTProfit by Euclid 
<t id="442">COMMAND_TYPE_TRADE_42</t> 
<t id="442">COMMAND_TYPE_TRADE_42</t> : Station Financial Manager Automate - Station Financial Manager by S9ilent 

Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod » Mon, 20. May 13, 01:20

I've uploaded version 1.1.0:

1.1.0
- Change the OK trade command ID from 42 to 48 to resolve a conflict. Note that following upgrade from 1.0.0 existing OK traders will temporarily show "Unknown command!" until their current action completes and the scripts restart.
- Automatically enable autojump and set min jumps to 0 when starting the OK trade command.
- Detect danger and return to homebase. Display subtitle messages when a trader detects danger.
- Reroute to new destination if current trade mission is invalidated, for example if destination ware price becomes unacceptable with respect to homebase selling price
- Buy wares without first returning to homebase if ship has sufficient jump energy to get there and home again, or if the ship isn't jump capable
- Add a minimum stock level percentage trade threshold with default of 10% (sell when above 10% stock, buy when below 90% stock).
- Improve displyed command action details
- Fix amount of ware on order calculation to include amount in cargobay

User avatar
joelR
Posts: 2008
Joined: Mon, 9. Jul 07, 23:33
x3tc

Post by joelR » Mon, 20. May 13, 05:16

Shimrod wrote: - Buy wares without first returning to homebase if ship has sufficient jump energy to get there and home again, or if the ship isn't jump capable
Thanks for this.

User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle » Mon, 20. May 13, 06:03

This script is a breath of fresh air, Shimrod. :)

I have been using OK Traders for a few days to replace CAG for a complex, and they do the job nicely. Much easier to understand and set up than CAG; just turn them on, follow the easy menu, and start them up.

Nice.


* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
One thing I noticed: After I start an OK Trader, his orders are no longer visible. If I return to his settings menu, the defaults automatically populate rather than his current orders. It would be nice to be able to see his current orders so that I can check, then cancel, to make sure that I set it correctly.
Last edited by DrBullwinkle on Mon, 20. May 13, 10:43, edited 1 time in total.

Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod » Mon, 20. May 13, 10:40

Sure, if the command is already running on a ship, it'd be straightforward enough to populate the menu selections from the ware entry list already stored in the trader's local variable.

It's quite difficult to test new features and regression test the old ones in this script as they're pretty situational. Unlike Smart for example where I can simply spawn an enemy of the right type for it to shoot, or a quite easily set up a fleet vs fleet battle to monitor. I've had traders flying around with 500 engine tunings on SETA, and to test enemy avoidance I moved the ship into the heart of a Xenon sector and started the command.

However nothing beats real usage so I plan to continue my XTC game with 1.1.0 loaded for a while before working on feature enhancements to help flush out potential problems, though if I do fix any bugs I'll try to roll out patch releases quickly. At the same time if you notice anything weird do let me know about it.

Vayde
Posts: 850
Joined: Fri, 6. Feb 04, 21:02
x3tc

Post by Vayde » Mon, 20. May 13, 21:59

I'll give the new version a few credits and a station or two and see how it ticks :)
Still life in the old dog yet...

Revolution Rising
Posts: 57
Joined: Sun, 29. Jul 12, 00:19
x4

Post by Revolution Rising » Tue, 21. May 13, 01:15

I LOVE this script, I am kinda new at the game and CAG had me about to throw it out the window. This script saved the whole deal ;) It's a lot more newb friendly.

I wonder how hard it is to make a script to have ships automatically equip themselves from stations, instead of having to look at every single sector looking for guns, shields etc..

I've been using Mistrals and Mistal SF's but finding the 25MJ shields and PRG's is hard in Boron space - usually need 5 for a Mistral and 4 for a SF. Most of the time there's only 3-4 on a station if I'm lucky. :!:

User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle » Tue, 21. May 13, 01:40

Revolution Rising wrote:I wonder how hard it is to make a script to have ships automatically equip themselves from stations, instead of having to look at every single sector looking for guns, shields etc..
Player Workshops or Yalamandis Shipyard

Revolution Rising
Posts: 57
Joined: Sun, 29. Jul 12, 00:19
x4

Post by Revolution Rising » Tue, 21. May 13, 02:17

Auto Repair ? :)

Edit: Actually I found Marine Repair, seems to be being updated as of last month, so will give that a go. Automating ships, but having them hit other ships and not automatically repair is rather annoying.

User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle » Tue, 21. May 13, 05:53

As you discovered, Marine Repairs and Training is a big help.

There is no general-purpose auto-repair, although many scripts include auto-repair of some sort. Off the top of my head, that includes: (There are probably others that I forgot to include.)
.

PS: We should probably move this Q&A elsewhere, and let Shimrod have his thread back!

Revolution Rising
Posts: 57
Joined: Sun, 29. Jul 12, 00:19
x4

Post by Revolution Rising » Tue, 21. May 13, 06:16

DrBullwinkle wrote: PS: We should probably move this Q&A elsewhere, and let Shimrod have his thread back!
Thanks for the info.

Yeah I realised that after my last post (sorry Shimrod), the reason I put it here however was the OK Traders were getting damaged (about 1 per day real time) so figured he might include some form of it ;)

Thanks for the Post Vayde too good info.

Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod » Tue, 21. May 13, 23:03

Repairs and equipping (shields, tunings, jumpdrive) are certainly something I'd consider in future though it's not an immediate priority.

Note that in 1.1.0 the trader will detect incoming hostiles within its max scan range and move to homebase, so assuming it has a jumpdrive, energy and not already in home sector, it should jump away before taking any damage.

So far in my game I've not had any casualties, and the warning subtitle message displays the sector name so I know which sector to blacklist or clean out if it recurs.

johntarmac
Posts: 393
Joined: Fri, 5. Mar 04, 19:47
x3tc

Post by johntarmac » Sat, 25. May 13, 12:02

Just started using this to free up my CAGs for CLS duties and it's working very well.

Cheers

Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod » Sun, 2. Jun 13, 14:37

I've uploaded a new version. The main feature is they can now operate as free traders. The free trader balance of profit or loss since the command was started is displayed in the menu. Note that when it buys its first wares/energy it will start out in the red.

There is no micromanagement involved. To make a free trader, start the command on a ship without a homebase. To make a station trader, assign a homebase then start the command.

1.2.0
- OK Trade can now be enabled on ships without homebases. They act as free traders and roam the galaxy in search of profit.
- When a ship is already running the command, the trade menu will display the ships's current settings or profit/loss so far in the case of a free trader.

Edit: Thought I'd found a problem...
Update: It turned out the homebase just had no money :doh: , everything is ok!
Last edited by Shimrod on Sun, 2. Jun 13, 17:28, edited 4 times in total.

User avatar
joelR
Posts: 2008
Joined: Mon, 9. Jul 07, 23:33
x3tc

Post by joelR » Sun, 2. Jun 13, 16:29

Thanks shimrod. Great addition.

What happens if I homebase a free trader after issuing the command?

Mythrantar
Posts: 173
Joined: Fri, 17. Jun 05, 06:35
xr

Post by Mythrantar » Sun, 2. Jun 13, 16:38

Thanks for the great mod! Maybe a silly question but here it is anyway: what makes an non-homebased OK Trader a better choice than a classic sector trader or a universe trader?

Post Reply

Return to “X³: Terran Conflict / Albion Prelude - Scripts and Modding”