[SCR] OK Traders v1.7.1 (04-12-14)
Moderators: Scripting / Modding Moderators, Moderators for English X Forum
-
hourheroyes
- Posts: 346
- Joined: Mon, 9. Apr 12, 05:14

Ok, I'll keep you posted ont he negative balance issue.
Now I'm having another one, though, where a bunch of my traders seem to have ended up hostile against the Split and Paranid (pirates perhaps?) and proceed to drop fighter drones to attack every lasertower they find in those sectors. Is there a way to tell them to just stay peaceful?
Now I'm having another one, though, where a bunch of my traders seem to have ended up hostile against the Split and Paranid (pirates perhaps?) and proceed to drop fighter drones to attack every lasertower they find in those sectors. Is there a way to tell them to just stay peaceful?
-
Shimrod
- Posts: 907
- Joined: Tue, 18. Feb 03, 01:43

Traders won't launch drones and missiles unless something is both hostile and targetting the trader.
Did you have restricted core sector access with those races, due to poor relations? In theory the trader should ignore those sectors if it has no docking rights at a target station.
Perhaps police scans have found quantities of spaceweed, made the race go hostile, then the trader has launched missiles and drones in defense to help it escape.
There's no setting to stop them retaliating. Launching drones and potentially attacking with lasers is also built into the stock signal_attacked script too, but OK traders are proactive and launch against hostiles approaching from their max scan range, while initiating jumpdrive.
Once equipping config is added you'll be able to prevent traders stocking up on missiles, lasers and drones.
Did you have restricted core sector access with those races, due to poor relations? In theory the trader should ignore those sectors if it has no docking rights at a target station.
Perhaps police scans have found quantities of spaceweed, made the race go hostile, then the trader has launched missiles and drones in defense to help it escape.
There's no setting to stop them retaliating. Launching drones and potentially attacking with lasers is also built into the stock signal_attacked script too, but OK traders are proactive and launch against hostiles approaching from their max scan range, while initiating jumpdrive.
Once equipping config is added you'll be able to prevent traders stocking up on missiles, lasers and drones.
-
hourheroyes
- Posts: 346
- Joined: Mon, 9. Apr 12, 05:14

No restricted core access, I try to stay at max relation with all Commonwealth races. I'm pretty sure they had no illegal goods, either. I do have some random issues with randomly hostile lasertowers, however. Maybe the trader jumped into one of these sectors with a hostile lasertower, which subsequently caused the trader to consider the whole race as a hostile, causing the trader "aggression".
Loving your scripts, by the way. I hadn't even bothered with a single UT in my most recent game due to micromanaging/losing them all in the more dangerous XRM universe. OK Traders seems to be making this finally possible again.
Also really like SMART but that's another topic.
Loving your scripts, by the way. I hadn't even bothered with a single UT in my most recent game due to micromanaging/losing them all in the more dangerous XRM universe. OK Traders seems to be making this finally possible again.
Also really like SMART but that's another topic.
-
Shimrod
- Posts: 907
- Joined: Tue, 18. Feb 03, 01:43

The script is deliberately coded not to launch countermeasures anything that's merely red, otherwise it would agro passing Duke's freight transporters, not to mention XTC where red ships passing in the trade lanes is pretty normal.
Seems most likely that one of these hostile lasertowers has targetted the trader, which launched drones at it to cover its escape, and with each shot fired at the lasertower the drones have damaged the race reputation with the lasertower's race.
For ref the ship builds a list of threats where:
In my AP vanilla game I'm on friendly terms with most so I've not encountered such problems myself, but I'll keep an eye out. It sounds like perhaps being able to remove any defensive measures via the equipping config feature can help fix your problem though, rather than needing to alter the defensive behaviour.
Do note that once the ship is actually hit by enemy ordinance, SIGNAL_ATTACKED kicks in and interrupts the OK trade script. The default attacked signal script is fairly simple and tends to just dump available drones with defend ship order, while trying to run away, but again I'd not expect this to make the trader go on a killing rampage.
Level 6 logging will trace out any threats identified and countermeasure launching activities to a Documents\Egosoft\X3AP\9055*.txt file, though do note that leaving logging enabled will reduce performance. This may help provide insight into what's going on, even just to provide insight into trader activities for yourself if curious.
Seems most likely that one of these hostile lasertowers has targetted the trader, which launched drones at it to cover its escape, and with each shot fired at the lasertower the drones have damaged the race reputation with the lasertower's race.
For ref the ship builds a list of threats where:
- The trader is the 'get attack target' of a [Find.Enemy] ship within 'get scanner range'
- The trader is the 'get command target' of a [Find.Enemy] ship within 'get scanner range'
- The trader's 'get attacker' is a enemy
In my AP vanilla game I'm on friendly terms with most so I've not encountered such problems myself, but I'll keep an eye out. It sounds like perhaps being able to remove any defensive measures via the equipping config feature can help fix your problem though, rather than needing to alter the defensive behaviour.
Do note that once the ship is actually hit by enemy ordinance, SIGNAL_ATTACKED kicks in and interrupts the OK trade script. The default attacked signal script is fairly simple and tends to just dump available drones with defend ship order, while trying to run away, but again I'd not expect this to make the trader go on a killing rampage.
Level 6 logging will trace out any threats identified and countermeasure launching activities to a Documents\Egosoft\X3AP\9055*.txt file, though do note that leaving logging enabled will reduce performance. This may help provide insight into what's going on, even just to provide insight into trader activities for yourself if curious.
-
hourheroyes
- Posts: 346
- Joined: Mon, 9. Apr 12, 05:14

I found one possible reason my ships keep turning up negative...they buy all sorts of lasers and don't focus on unloading them. I see one that has 33 Plasma Burst Projectors in its hold but it trying to buy and sell EBC's..
*edit*
Just looked and almost every trader has 20-30 lasers that it bought but isn't selling. Will they ever try to sell stuff already in their cargo?
*edit*
Just looked and almost every trader has 20-30 lasers that it bought but isn't selling. Will they ever try to sell stuff already in their cargo?
-
Shimrod
- Posts: 907
- Joined: Tue, 18. Feb 03, 01:43

Sounds like a bug. There'll be a patch release shortly for 1.4, I'm busy ironing out quriks. To help me repro the problem, could you let me know:
- Is this AP or TC?
- Any major mod (XRM, XTC)?
- What type of ship is it?
- Is it homebased, free, tethered, eco boosting, or tethered+eco?
Googling PBP I'm guessing XRM. I attempted to repro in vanilla AP without success, by spawning 2 types of trader, giving one weapons he couldn't equip and the other ones he can, but in both cases the traders went and sold the ware. It'll have to wait until this evening for an XRM repro.
The main issue with 1.4 I found so far is free traders buying items from docks will immediately sell them right back again, however they might well decide to buy the same item and trade it, in which case this works.
I've also found that economy boosting traders produce a noticeable slowdown when evaluating wares. I've added some small optimizations for this for the time being, but I suspect they'll need a more in depth revision.
- Is this AP or TC?
- Any major mod (XRM, XTC)?
- What type of ship is it?
- Is it homebased, free, tethered, eco boosting, or tethered+eco?
Googling PBP I'm guessing XRM. I attempted to repro in vanilla AP without success, by spawning 2 types of trader, giving one weapons he couldn't equip and the other ones he can, but in both cases the traders went and sold the ware. It'll have to wait until this evening for an XRM repro.
The main issue with 1.4 I found so far is free traders buying items from docks will immediately sell them right back again, however they might well decide to buy the same item and trade it, in which case this works.
I've also found that economy boosting traders produce a noticeable slowdown when evaluating wares. I've added some small optimizations for this for the time being, but I suspect they'll need a more in depth revision.
-
DrBullwinkle
- Posts: 5715
- Joined: Sat, 17. Dec 11, 01:44

Just guessing here, but I would think that traders could do an eco-boost trade once out of maybe ten trades. Or once in five. They certainly do not have to check on every trade.
Peace through superior firepower
Bullwinkle's List | Marine Repairs and Training | Mobile Mining Mk2 | Drone Carrier Software 2 (DCS2) | Ship Tricks: Mini-Guides (with Video)
Bullwinkle's List | Marine Repairs and Training | Mobile Mining Mk2 | Drone Carrier Software 2 (DCS2) | Ship Tricks: Mini-Guides (with Video)
-
hourheroyes
- Posts: 346
- Joined: Mon, 9. Apr 12, 05:14

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

No joy with the repro. I spawned a mistral in argon prime, 30 PBPs, started OK and it's hopping around from one military base to another selling 1-2 to each as stock permits. Default race rep for anonymous argon or whatever.
Are all the traders hoarding lasers of the same PBP type or different types?
Does anyone else have the same problem?
If you enable level 9 or 10 logging on a trader that isn't selling the PBP's, and examine the output at the point it has stopped at a station and begins deciding on its next mission, this might help suggest why it isn't selling. Be sure to limit the logging to the 1 trader to avoid flooding the logfile.
In the event I inadvertently fixed this already in 1.4.1, I've released this so you can try it out:
1.4.1
- Improve eco trader performance a little when evaluating wares to trade
- Fix: prevent eco traders from selling secondary resources to stalled factories, not helping economy
- Fix: ships buying wares at docks would sell the ware back to the dock afterwards (1.4.0 regression)
Are all the traders hoarding lasers of the same PBP type or different types?
Does anyone else have the same problem?
If you enable level 9 or 10 logging on a trader that isn't selling the PBP's, and examine the output at the point it has stopped at a station and begins deciding on its next mission, this might help suggest why it isn't selling. Be sure to limit the logging to the 1 trader to avoid flooding the logfile.
In the event I inadvertently fixed this already in 1.4.1, I've released this so you can try it out:
1.4.1
- Improve eco trader performance a little when evaluating wares to trade
- Fix: prevent eco traders from selling secondary resources to stalled factories, not helping economy
- Fix: ships buying wares at docks would sell the ware back to the dock afterwards (1.4.0 regression)
-
alt3rn1ty
- Posts: 3923
- Joined: Thu, 26. Jan 06, 19:45

Not here - Just checked all traders in XTC 2.1 setup, and AP setup ( No major mods in AP apart from Combat Mod 4 )Shimrod wrote:Does anyone else have the same problem?
However I do have a new problem with OK 1.4.1
1.4.0 seemed quite smooth in the performance
But after installing 1.4.1 on my AP setup, which is currently running 8 Traders homebased, and 11 Eco Traders, has gone laggy. Noticeably laggy bordering on slideshow.
I thought maybe after the upgrade things may settle down after all traders adapted to the new scripts. But having completed an AP mission to go find someone holding some shares in The Vault, and returning to continue helping a company out, I have flown through ten sectors, jumped numerous times, and watched all traders finish off their previous trades - after installing 1.4.1.
I am now pretty sure the lag is not going to clear up, and seems to be attributable to installing this version of OK. If in SETA ( 500% ), I can count 2 seconds between lag 'skips'. Without SETA the periodical sets of lag are annoyingly noticeable.
There is nothing else going on like windows updates in the background, nor is any anti virus interfering ( MSSE has No Steam AP exe as an exception ) .. Nothing changed from previous gaming session apart from installing 1.4.1
All traders / eco traders are mostly Mistral, I have one Zephyrus homebased to the Hub, and maybe an odd caimen amongst them.
-
Shimrod
- Posts: 907
- Joined: Tue, 18. Feb 03, 01:43

Sorry to hear that, I'll see if I can reproduce it tonight. To confirm it's OK you can run the uninstall option from the menu. This should terminate running scripts.
Check if any traders seem to be just sitting there and never performing a mission. If Eco traders in particular are just sitting around scanning for things to trade, this could be very laggy if 11 of them are at it.
Lag will tend to occur when traders are scanning for a ware to trade, in between runs. Little processing should occur if the ships are in flight.
Check if any traders seem to be just sitting there and never performing a mission. If Eco traders in particular are just sitting around scanning for things to trade, this could be very laggy if 11 of them are at it.
Lag will tend to occur when traders are scanning for a ware to trade, in between runs. Little processing should occur if the ships are in flight.
-
alt3rn1ty
- Posts: 3923
- Joined: Thu, 26. Jan 06, 19:45

Is that just a symptom of using too many Eco Traders ?
I converted all Free traders to Eco Traders just after the update to 1.4.0
Which was running smoothly.
The lag with the same bunch of Eco Traders has only started occuring after updating to 1.4.1
ie 11 Eco Traders are not new to this setup, but 1.4.1 is.
I converted all Free traders to Eco Traders just after the update to 1.4.0
Which was running smoothly.
The lag with the same bunch of Eco Traders has only started occuring after updating to 1.4.1
ie 11 Eco Traders are not new to this setup, but 1.4.1 is.
-
alt3rn1ty
- Posts: 3923
- Joined: Thu, 26. Jan 06, 19:45

Confirmed - Ran the Un-install, savedShimrod wrote:confirm it's OK you can run the uninstall option from the menu. This should terminate running scripts.
Renamed setup.glen.trade.ok.xml
to bak-setup.glen.trade.ok.xml
Continue game = Lag gone.
So users limiting the amount of Eco Traders would be the way to go with 1.4.1 onwards.
I'm going to rename setup script back to normal, continue game and re-setup all traders .. But limit Eco traders to 1 or 2. The rest can go back to homebased traders and Free traders - See how it goes.
Wont be a problem anyway figuring out who was doing what, they are all still named as OK left them
-
Shimrod
- Posts: 907
- Joined: Tue, 18. Feb 03, 01:43

That sounds conclusive. The reason for their worse performance is that eco traders use the same algorithm for finding best ware to trade:
for each tradeable ware
{
1. find station to buy it at for best price
2. find station to sell it at for best price
3. calculate amount of profit that would be made for this ship/ware, based on amount of cargo, volume of ware, amount available, and amount destination can consume
}
4. Sort the entries { ware, buy at, sell at } by profit
5. Pick the highest profit trade and do that
Step #2 becomes much more expensive because the script must loop through and test if the stations are stalled, adding producing ones to an exclude list and trying again.
1.4.1 prevents eco traders selling secondary wares, so this will increase the amount of work to identify viable trades.
The approach I'm considering is to simply exit the loop as soon as it finds the first profitable trade to a stalled station.
To avoid a scenario where an eco trader runs out of stalled stations to trade at, I'm also considering making it fall back to performing a regular trade.
If this doesn't work, a more complex option is a background task that scans non-producing stations and updates a lookup table.
for each tradeable ware
{
1. find station to buy it at for best price
2. find station to sell it at for best price
3. calculate amount of profit that would be made for this ship/ware, based on amount of cargo, volume of ware, amount available, and amount destination can consume
}
4. Sort the entries { ware, buy at, sell at } by profit
5. Pick the highest profit trade and do that
Step #2 becomes much more expensive because the script must loop through and test if the stations are stalled, adding producing ones to an exclude list and trying again.
1.4.1 prevents eco traders selling secondary wares, so this will increase the amount of work to identify viable trades.
The approach I'm considering is to simply exit the loop as soon as it finds the first profitable trade to a stalled station.
To avoid a scenario where an eco trader runs out of stalled stations to trade at, I'm also considering making it fall back to performing a regular trade.
If this doesn't work, a more complex option is a background task that scans non-producing stations and updates a lookup table.
-
DrBullwinkle
- Posts: 5715
- Joined: Sat, 17. Dec 11, 01:44

There is no rush for the Eco Traders. You could have long sleeps in the loop.
Is it really necessary to have special-purpose Eco Traders?
Is it really necessary to have special-purpose Eco Traders?
Peace through superior firepower
Bullwinkle's List | Marine Repairs and Training | Mobile Mining Mk2 | Drone Carrier Software 2 (DCS2) | Ship Tricks: Mini-Guides (with Video)
Bullwinkle's List | Marine Repairs and Training | Mobile Mining Mk2 | Drone Carrier Software 2 (DCS2) | Ship Tricks: Mini-Guides (with Video)
-
alt3rn1ty
- Posts: 3923
- Joined: Thu, 26. Jan 06, 19:45

I have got everyone up and running as before .. But decided first to try out no Eco Traders.
So running with 8 homebased traders, and 11 free traders = Nice and comfortable in the performance again after having half hour real time continued gaming - Which corroborates Eco Traders get expensive on processor time.
Will try converting now just a couple of them to Eco Traders, 1 at a time to find my machine sweet spot.
To be honest I dont have the best of machines to begin with, but being lower spec than average these days I have the privilege of being able to spot when anything is bordering on getting heavy in CPU usage - Core 2 Duo @ 2.2ghz
So regard me as a lowest common denominator - But please do not feel obligued to accommodate such low specs, I seriously need to upgrade
So running with 8 homebased traders, and 11 free traders = Nice and comfortable in the performance again after having half hour real time continued gaming - Which corroborates Eco Traders get expensive on processor time.
Will try converting now just a couple of them to Eco Traders, 1 at a time to find my machine sweet spot.
To be honest I dont have the best of machines to begin with, but being lower spec than average these days I have the privilege of being able to spot when anything is bordering on getting heavy in CPU usage - Core 2 Duo @ 2.2ghz
So regard me as a lowest common denominator - But please do not feel obligued to accommodate such low specs, I seriously need to upgrade
-
alt3rn1ty
- Posts: 3923
- Joined: Thu, 26. Jan 06, 19:45

One request for later :
When re-setting everyone up after the un-install, I needed to setup the Blacklist again which includes the very handy group Adds ..
Pirate
War
Non-Jumpable
Could you add Xenon to that list ? ( If they already are then they are not currently being detected in my game by OK Blacklist .. I have 6 Xenon sectors revealed on the map )
Not sure if this is meant to happen, but I have one Free Trader ( previously he was an Eco Trader ) doing a bit of bio trafficking :
In the Property list he is currently noted as doing ..
Sell Ware .. Mercenaries
Mercenaries: 8
But they do not appear in the Freight list or People list.
When re-setting everyone up after the un-install, I needed to setup the Blacklist again which includes the very handy group Adds ..
Pirate
War
Non-Jumpable
Could you add Xenon to that list ? ( If they already are then they are not currently being detected in my game by OK Blacklist .. I have 6 Xenon sectors revealed on the map )
Not sure if this is meant to happen, but I have one Free Trader ( previously he was an Eco Trader ) doing a bit of bio trafficking :
In the Property list he is currently noted as doing ..
Sell Ware .. Mercenaries
Mercenaries: 8
But they do not appear in the Freight list or People list.
-
Shimrod
- Posts: 907
- Joined: Tue, 18. Feb 03, 01:43

This would have no effect unless there are stations in Xenon sectors the player can trade with. Blacklist doesn't affect move pathing (at least, not at the moment), only selection of destination sectors.Could you add Xenon to that list ?
Btw it's ok to run the uninstall option without saving and deleting scripts, the key thing is that it terminates the script if it finds it running on any ships, so it's an easy way to kill off OK to determine if it's causing performance hits. The uninstall option doesn't affect anything outside the current savegame, so you can just reload afterwards.
Definitely not mean to happen, I'll need to exclude wares that show up in the marine slots instead of regular cargo. XRM TS seem to have 0 marine slots, probably why none actually got bought.But they do not appear in the Freight list or People list.
Wise plan, at least until I figure out a good way to optimize them.just a couple of them to Eco Traders
-
alt3rn1ty
- Posts: 3923
- Joined: Thu, 26. Jan 06, 19:45

-
hourheroyes
- Posts: 346
- Joined: Mon, 9. Apr 12, 05:14

