[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

Post Reply
Posts: 13
Joined: Tue, 16. Feb 16, 13:43

Post by RoflCopter4 » Sat, 20. Feb 16, 07:39

Does anyone else find that their traders often spend large stretches of time doing absolutely nothing, then go on a trading spree, then go back to doing nothing for a few hours? I'm not sure if there's something weird going on or if this is just X3 being X3. At this point my save game has had so many mods installed, removed, reinstalled, tweaked, removed, etc that I'm surprised my computer hasn't caught fire, so I wouldn't be shocked to hear something weird is actually going on here.

Posts: 59
Joined: Sun, 18. Aug 13, 23:03

Post by Zfast4y0u » Thu, 1. Sep 16, 23:16

ok guys i have problem with my Space fuel complex and trade ships trading space fuel with home base signed and using this script with em..

i posted my problem here:

http://forum.egosoft.com/viewtopic.php? ... 67#4627567

any help would be great!!

Posts: 7
Joined: Mon, 5. Sep 16, 14:51

Post by shulthz » Mon, 10. Oct 16, 04:49

I've installed XTC 2.2 with hotfix 22. I created 50 docked drakes and broadcast OK to them.

The traders started out selling all the equipment I spawned on them that they don't need, like excess energy and ammo. During this time I get no apparent slowdown at 10x seta, nor while fighting 20 xenon M spawned around my tapian. This tends to suggest the monitoring task running on each trader isn't what's taxing the cpu.

Still no appreciable slowdown after I left it on seta for a while. I've been observing an ATF vidar fighting 10 xenon fujin at seta 10x while rotating the camera and its pretty smooth.

This is on i7-2600k with 16gb ram, win7 x64.

All I can say at this point is, make sure ok's debug mode is disabled as the file logging has a big overhead, and minimize the number of economy boost mode traders.

Posts: 84
Joined: Mon, 13. Feb 12, 09:22

Post by RustInPieces » Mon, 10. Oct 16, 18:45

Is there any way to disable energy cell automatic refuel? I am using cycrows advanced jumpdrive. It works with these, they are jumping without using energy cells using OK Trade, but they still buy 900 some energy cells when I first start the script.

Posts: 7
Joined: Mon, 5. Sep 16, 14:51

Post by shulthz » Tue, 11. Oct 16, 03:13

No way, or you can revise the script :lol:

Posts: 84
Joined: Mon, 13. Feb 12, 09:22

Post by RustInPieces » Thu, 13. Oct 16, 17:12

How can I broadcast an order to start OK traders on multiple ships in the same sector? All I see is an option to broadcast to docked ships.

Posts: 84
Joined: Mon, 13. Feb 12, 09:22

Post by RustInPieces » Thu, 13. Oct 16, 17:24

Nevermind, I used the broadcast to my ships in sector command, had them all dock at the equipment dock (handful at a time) and used the broadcast OK Trader to docked ships option.

Marco Nero
Posts: 160
Joined: Tue, 19. May 09, 09:25

Post by Marco Nero » Fri, 28. Oct 16, 13:05

"The global settings page also contains a Min Stock Level Trade % setting. This is used to create a buffer which must be exceeded before a homebased trader will trade a ware. The purpose of the setting is to avoid traders performing small trades, such as immediately re-buying the jumpdrive energy they refuelled with. This setting only applies to triggering a trade run; the trader will still use the full range of the stock level, or as limited by Min and Max Stock Level % settings described earlie..."

Hi all guys, unfortunately this doesn't work for me :)

I have a Huge complex, selling about 15 different products, shield, weapons, lasertower and so on.

I have 30 Ok Traders assigned to this complex, but other races sectors demands lasertowers (for example) and i HAVE lasertowers produces and in stock in my complex, but traders still make 1 traver for 1/2/7 Hull plating. I can see 10 traders buying ore and silicon wafers for supplying the production activity, and the other 20 selling minimum number of hull plating instead selling lasertowers, shields and so on. I put "50" (the max) in max gates to jump in the complex setting, i try put 10%-80% on the global trader setting but nothing changed, i try also to change min/max sell in the stock limit, nothing changed, why are my traders selling little number of hull plating when they can sell high number of lasertowers and shields? I'm mistaking something maybe? I'm using A.P.+XRM btw :)

Thanks for the attention and have a nice day you all

Posts: 94
Joined: Tue, 3. Mar 15, 14:32

Post by Pind » Sat, 15. Apr 17, 05:54

I have a couple bug fixes for OK Traders, one of which may solve some of the problems in the previous posts.

Both bugs apply to Homebased traders (CAG replacements) that are homebased to an HQ or Equipment dock.

#1 BUG - Ware priority is based on actual max capacity for a ware instead of the dockware limit (AKA the OK traders keep selling a crappy low-volume ware)

Fix: in glen.trade.ok.lib change

Code: Select all

$Priority = (($Amount.Current - $Limit.Min) * 100) / ($Max.Actual - $Limit.Min)

Code: Select all

$Priority = (($Amount.Current - $Limit.Min) * 100) / ($Limit.Max - $Limit.Min)

#2 BUG - Min sell range was not working (again using max capacity for ware instead of dockware limit)

Fix: in glen.trade.ok.config, here is my code for the <Lib.Config.Get.Stock.Limit.Min:> SUB

Code: Select all

gosub Lib.Config.Get.Stock.Limit.Common:

if $Owner == [Player]
$rc = ($Range * $Min) / 100
$Dockware.Limit = [THIS]-> call script 'glen.trade.ok.config' : Func=$Lib.Config.Get.Dockware.Limit Arg1=$Station Arg2=$Ware Arg3=null Arg4=null Arg5=null
skip if $Dockware.Limit == null
$rc = ($Dockware.Limit * $Min) / 100
$rc = ($Range * $Min) / 100

do if $Config[$Config.Debug.Enabled]
= [THIS]-> call script 'glen.trade.ok.trace' : comp=$Comp lvl=10 fmt='Lib.Config.Get.Stock.Limit.Min: Ware=%s, Station=%s, Min.Perc=%s, Range=%s, rc=%s' arg1=$Ware arg2=$Station arg3=$Min arg4=$Range arg5=$rc

[EDIT] Another way to fix the low-volume sell priority problem is to include the volume of the ware into the priority calculation.

Posts: 94
Joined: Tue, 3. Mar 15, 14:32

Post by Pind » Sat, 15. Apr 17, 09:54

Found another, deeper problem that was really weird.

Basically $Limit.Max returned by trade.OK.config would get corrupted or something in the process of being called from trade.OK.lib

This would really **** up some of the priority calculations.

I could not find out why this was happening, so I just hacked it by moving the Limit.Max calculation logic into trade.OK.lib

Posts: 105
Joined: Sun, 17. Jul 11, 16:02

Post by maxolina » Mon, 29. May 17, 20:57

This mod basically makes MK3 trading software useless if I understand it right?

Posts: 1010
Joined: Wed, 4. Feb 04, 18:37

Post by BlackArchon » Tue, 30. May 17, 20:08

maxolina wrote:This mod basically makes MK3 trading software useless if I understand it right?
Even better: it makes the MK3 trading software AND the CAG script obsolete. :)

Posts: 55
Joined: Mon, 7. Mar 16, 15:06

Post by DarthNihilus » Sun, 12. Nov 17, 13:51

mod has a flaw. i had a situ when homebased to an empty tradestation and instead of saying to me that it's empty it showed a regular window that I need a TM2. I wasted an hour trying to find out what i messed up with the mod till i remembered that between saveload process i forgot to put some wares into my TStation.
jeeez lmao

User avatar
Posts: 930
Joined: Thu, 26. Jan 06, 20:45

Post by alt3rn1ty » Fri, 8. Dec 17, 22:04

@Shimrod TC and AP were updated https://forum.egosoft.com/viewtopic.php ... 27#4691927

Is this version of OK Traders still okay ?

With the changes listed in the release post I cant imagine this mod being affected, but would be nice if you could give it a quick look over and confirm.

User avatar
Posts: 15
Joined: Sun, 20. Jan 19, 21:35

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

Post by Altruist » Mon, 4. Mar 19, 05:55

Well, the OK Trader is around since years and it might be a bit late but I really want to say: THANK YOU SHIMROD!

I've become quite addicted to the simple effiicient helpfulness of the OK Traders, can't imagine playing TC without them... I tried but once hooked, you can't go back to the hassle and restrictions.

It's a true masterpiece of a script. And really excells to take over what otherwise would be, at least after a while, braindamaging boring, repetitive micro-management one needs to do the hundredth time.

As a matter of fact, the OK Trader is that good as an Universal Trader that you run the risk of spoiling your game a bit because it makes you rich too easily. So in my present game I restricted myself to not using the UT-option but only as traders homebased to self built and owned factories and complexes. And here, too, the script really shines. Huge complexes with dozens of wares, resources and intermediate products: you can either use the default orders, leave everything alone and it will work or you can dive a bit into the stock limit section and make your complex THE brimming commerce center.

The OK-Trader is also a true survivor. I have repeatedly seen a simple TS-freighter survive clashes with upto 2 Xenon Q plus escorts, kicking out drones to gain the time to jump out. And if one OK-Trader died, usually it was my own fault (or greed) for not putting a very dangerous sector onto the blacklist where Xenons regularly cross thru.

Two additional comments:

1) Problems with missiles and some kinds of usually high quality weapons
Several players complained about the problems the OK-Trader seems to have with selling missiles and weapons from factories/complexes. True. But think a bit before complaining: A factory producing firestrom torpedos can store no more than 8 torpedos than it's full and stalled. So, of course, the OK-Trader tries to sell them to avoid that the whole production is stalled. And if you have built several firstorm factories, there is still the problem that in all the universe there is no spot where you can sell more than 2 torpedos. This is highly inefficient, quite correct.
The exact same problem arises with lots of weapons or lasertowers: low storage and gets only bought in tiny fractions.
A workaround is:
a) manually: either living with it and building this type of factories only for your own usage
b) semi automated/manually especially for missiles using an additional fine script:
# Station Camper, made by Cycrow: [SCRIPT] Station Camper V1.00 : 11/02/2010
and letting a stationary big freighter automatically buy all those pesty special wares and when the "Camper" is full, just send him to the next company HQ
c) automated: assign approbiate ships as OK Traders to sell those wares with a (relatively) fast Mistral (130m/s) or in special cases with a TM, TP or even hyperfast (and cheap) M5 Kestrels with sufficient cargo (remember also the needed cargo space for energy for jumps and thus your choice will probably come down to the Mistral or Boron TP Angel) to sell the "special" wares like lasers, missiles etc... and thus freeing your freighters with 10k XL cargo space to do some serious stuff instead of flying around with 2 torpedos or 16 PAC.

2) Stock limit section
It's a request,finally, just in case, Shimrod, you are still playing TC, using your own script and still in the mood to tinker around with it. In huge complexes with many wares, the stock limit section can become a bit of a pain. A simple (well, perhaps, I am no modder) big improvment:
The list of wares in the stock limit section would be much userfriendlier if alphabetically sorted and as a bonus in the same line in brackets the size of the factory storage room for that ware (which makes it much easier to know what smart min/max limits might be) and the weight of the ware.

And if you can't bother with it, never mind.
Thanks for the great script.
I had a look at the changelog... this script took time and testing and then even more work (and probably this work modders dislike the most) to get it into a foolproof state to get used by us.

Post Reply

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