[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: Scripting / Modding Moderators, Moderators for English X Forum

Shauwn205
Posts: 5
Joined: Mon, 2. Jul 12, 09:06

Post by Shauwn205 »

Very awesome, thanks for the really fast fix! Great work and the addition to the blacklist was the next thing on my wish-list, too! :D
Keep up the good work!
User avatar
Quinch
Posts: 362
Joined: Thu, 10. Jun 04, 01:09
xr

Post by Quinch »

I'm not sure if I thanked you for this script of not yet, but it bears repeating - it's awesome. Thanks for its continued support, too.

Can I also ask for a teeny tiny feature? In addition to homebased and landed ships, would it be possible to send the trade commands to specific fleets? I.e., select a var/fleet commander and propagate the settings to all ships in the fleet?
I wasn't banished to the moon yesterday.
Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod »

1.6.4 uploaded.

1.6.4
- Add option for broadcasting OK trade to AP fleets
- Allow broadcasting from free traders in addition to homebased traders
User avatar
Quinch
Posts: 362
Joined: Thu, 10. Jun 04, 01:09
xr

Post by Quinch »

Awesome! Thanks Shimrod!
I wasn't banished to the moon yesterday.
Phraggah
Posts: 29
Joined: Fri, 30. Mar 12, 05:54
x3ap

Post by Phraggah »

This is a great script, it integrates all the different roles of freighters and traders and puts them into one interface with no hassle. Thanks!

Feature request: automatically name traders in a sequence rather than having the same name(Free Trader 001, 002, etc.), and (more theoretical) squadron-like freighter mass managing to make buying multiple freighters, moving them around and docking them to get them the software they need to OK Trade in bulk!
Inzann
Posts: 19
Joined: Tue, 6. Nov 12, 01:41

Post by Inzann »

Might be a stupid question, but is there any way I can see a traders statistics? Like profit?
Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod »

The OK Trade menu on a free trader shows the balance of its trades, as well as the balance of all free trader trades. This includes everything the trader pays for like equipping, repairs and fuel, so it typically goes in the red early on. The counters can be reset by selecting them in the menu.

Re equipping, the broadcast options in the OK Trade menu should help with that. I added this specifically so I could buy multiple ships then apply OK Trade (and homebase, if broadcast from a homebased ship) to them in 1 go. Those ships then go off and buy engine tunings, jumpdrives and energy (per global equipping config) before starting trading. I dropped plans for a more elaborate equipping system due to general lack of free time, and lack of playing X within that free time.

Re naming, I used to have the ship ID code as part of the name to help identify a trader that had been attacked, but decided to trim it out to keep the name less jarring. The ship ID is visible in the property menu so I just updated the trader under attack message to include the ship ID, which I can then scan for in the property menu (though attacked ship is typically flashing anyway), addressing that particular need.

An option to include a number or ID code could be added, but I'd like to understand the requirement better.
Inzann
Posts: 19
Joined: Tue, 6. Nov 12, 01:41

Post by Inzann »

- Add an economy boost mode for free traders, where they prioritize trading at stalled factories.


What does this really mean? That it will do trades where stations are really lacking in a material = more profit?
User avatar
Quinch
Posts: 362
Joined: Thu, 10. Jun 04, 01:09
xr

Post by Quinch »

As far as I can tell - correct me if I'm wrong - it means that they will focus on keeping NPC stations supplied, rather than focusing on raw profit. So, for example, if there's a choice between delivering wheat to station A which already has enough resources to keep it running at a 2000 profit and delivering a load of energy cells to station B which is completely out of them for just 1500 profit, station B will take priority.
I wasn't banished to the moon yesterday.
Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod »

Economy boost traders first look at stations with stalled production as determined by the following:

Code: Select all

$Station -> get production status : as percentage = 0
The trader examines those station's ware lists in order of lowest stock and seeks to find a trade opportunity where it won't make a loss on the trade.

The stalled stations are traversed in no particular order. They must of course meet all the usual constraints; known to player, within tether range.

If it finds no stalled stations the eco boost trader should do a standard free trader mission.
MacFarl8ne
Posts: 8
Joined: Wed, 7. Aug 13, 07:15
x3ap

Post by MacFarl8ne »

I have 2 problems:

first, my transporters dont upgrade themself. i have a transporter, with everysoftware, he has a homebase, his range includes equipment docs and even a shield factory, but he doenst upgrade himself. could someone please specify what the requirements for upgrading are?

my second problem is that i dont see in my message log if a transporter is destroyed. i only get a message when it happens, but if im away from the pc i cant check in the log what happened in the meantime.
Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod »

Traders only go out of their way to buy jumpdrives and engine tunings. All the other upgrades are bought passively when the trader docks at a place that sells them. Unfortunately this might be never for a homebased trader that doesn't trade at EQ docks. I'd like this to be more configurable but am taking a break from X at the moment.

The script doesn't write log messages when ships are destroyed, I thought the game did that already. OK trade doesn't override any signal handlers so it shouldn't interfere with existing functionality. Functionality like that could be added through signal handling, but it's not going to happen any time soon, so it'd be worth searching for prior art.
MacFarl8ne
Posts: 8
Joined: Wed, 7. Aug 13, 07:15
x3ap

Post by MacFarl8ne »

Hey Shimrod, thanks for making that clear. perhaps you can add this information in your first post. and great work btw


PS: i understand that you take a break from X. actually i wanted to do the same, but i had somehow to kill some time till elite dangerous and star citizen (i wont even mention x-rebirth)
Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod »

I've added a section to the 3rd post that has the documentation.
Auto Equipping

Equipping settings (jumpdrive, docking computer etc) can be configured globally in the OK Trade menu.

Note that the trader will only go out of its way to buy a jumpdrive and engine tunings. Other items such as scanners and docking computers are purchased lazily, if the trader happens to dock at a station selling that ware.
I'm in ED standard beta, currently only have access to a combat scenario build as it's still in premium beta, star citizen also preordered. In my spare time I'm mostly playing Skyrim at the moment, have followed the entire Skyrim Beautification Project guide and added more stuff on top, really enjoying it.
gen lee outrageous
Posts: 16
Joined: Fri, 18. Jun 10, 20:55
x3tc

Post by gen lee outrageous »

Love this script to pieces so far, just one issue though. My traders don't seem to want to use their jump drive! It's set to pick one up in the config, and has one equipped, even has fuel. Could it have something to do with the advanced jump drive settings in the ship command main menu?
Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod »

OK doesn't explicitly perform jumps. When starting the script it enables autojump in the ship config with min jumps 0, and to go from A to B it calls the stock Egosoft movement scripts, which are autojump-aware.

So I think the problem is outside of OK trade somewhere. Perhaps autojump settings have been manually edited after starting OK trade, or a mod has modified the Egosoft scripts.

Try using a standard move to sector command on a trader that isn't using it's jumpdrive. If autojump is enabled with min jumps 0 it should jump there, assuming there's a jumpgate.
Fun-X
Posts: 184
Joined: Sun, 19. Jun 05, 06:34
x4

small bug

Post by Fun-X »

There seems to be a small bug.

I have a complex with 10 OK station traders, where 4 are set to buy Energy Cells (EC), and 6 are set to sell EC. (Price point is 12)

It buys fine.

It generally sells fine.

Except:
When it sells to a station in the same sector, and the ship has more EC than are needed by the destination station, it will sell all of the EC it can, and top of the destination station to 5000/5000. Ok, so far so good. Except, that if it has EC left in the cargo bay of the selling ship, it will sit at the destination station and wait for the destination station to complete a cycle (or as many as it takes) so that it can sell the remaining energy cells to the destination station. Of course, cycle times can be very long, and the OK station trader might sit there for a long time.

As a work around, I can simply use smaller ships.
Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod »

OK doesn't have logic to camp at stations, normally traders return to homebase if there's nothing to do. It'd be useful to see logging from the trader that's sitting at the station. Logging is enabled through OK's menu:

- Undock trader from the station its sitting at
- Set trader as logging target
- Enable verbosity level 6 logging
- Dock trader and re-enable OK Trade
- Examine: %USERPROFILE%\Documents\Egosoft\X3AP\log09055.txt
Fun-X
Posts: 184
Joined: Sun, 19. Jun 05, 06:34
x4

Post by Fun-X »

ok.

It did it again. It first topped off the Quantum Tube Fab. It had 101 ec left. I undocked as requested. I enabled level 6 debug. I re-docked. I started OK Trader.

It then sat a short while.
It then it sold qty=30 to top off the factory
It then sat a short while
It then it sold qty=30 to top off the factory
It then flew home with qty=41

Here is the log file

https://www.dropbox.com/s/iiuc2vedoqeoyr0/log09055.txt

By the way, it made the original sale at price=16, even though there were price=19 in nearby sectors.

Not sure if it matters, but I have the mod Litcubes Universe, Mosquito, and SEWN
Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod »

Thanks for capturing that.

The core issue appears to be selling EC at price point 12 flushed out a bug with the trader deciding to sell wares to a fully stocked station, which wouldn't normally be encountered as people don't generally sell at lowest prices.

Regarding selling at 16 originally, once it settles on a sale mission it only re-routes if dest price falls below the configured minimum. I didn't make them periodically scan for better deals for a few reasons, though could always experiment with it if/when I switch back to playing AP.
- Performance
- The trader may keep re-routing back to a sector it recently escaped from due to hostility.
- I feared traders might keep chopping and changing as better prices occur, resulting in less profit over time due to extra travelling.

If there was a better price available to begin with within the jump radius that'd be a bit odd. Actually the station search APIs have different modes: nearest, best chance, best price. The best chance version seems to work best for traders without jumpdrives, and the game engine tends to favour nearby stations even though the profit might be lower. I use the best price option when the trader has a jumpdrive, so as long as the other station with better price is within the radius and meets docking, blacklist requirements etc, I'd expect it to come up top in preference.

I suspect the recent jumpdrive energy optimization changes have exacerbated the problem with selling ecells at 12. When setting out from the homebase a trader would now calculate that it needs to retain more jump energy than it does on an inward leg, so it would find it has surplus energy after selling to the target and look to sell this.

If it did go to some other station just to sell a little leftover energy that'd be pretty inefficient, so may need to de-optimize the energy calcs a little and have the homebased trader retain a fixed amount of the round trip of its mission.

If possible I'd suggest selling ecells at minimum 13 in the meantime to avoid this camping behaviour. I won't be able to investigate more this evening.

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