[SCRIPT] Autotrader Sector Lock 1.0 . . . . . . . . { UPDATED 2007/05/30 }

The place to discuss scripting and game modifications for X³: Reunion.

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

User avatar
halo112358
Posts: 374
Joined: Thu, 16. Feb 06, 07:56
x3

[SCRIPT] Autotrader Sector Lock 1.0 . . . . . . . . { UPDATED 2007/05/30 }

Post by halo112358 » Tue, 22. May 07, 03:37

Script: Autotrader Sector Lock 1.0
Author: halo
download: .zip / .spk
The "Autotrader Sector Lock" command locks sectors so your autotraders (UT, Local Trader, Sector Trader) will not select stations in these sectors as buy or sell targets. The script uses the autotrader's built-in locking mechanism and is therefore compatible with all derivatives of the autotrader (gnasirator's UT improvements, satellite limited UT, local trader, etc..).

"Autotrader Sector Lock" will lock a sector perpetually, scanning occasionally for new stations, you must unlock the sector if you want your autotraders to use the sector again.
[ external image ] [ external image ] [ external image ]

What it does:

This script package allows you to blacklist sectors for your autotraders. The UT, sector trader, and local traders will not attempt to buy from or sell to stations in a blacklisted sector. This is something people have been asking for since X3 came out and there's always one sector in my games that's a UT deathtrap, so here's an implementation.

New Trade Commands:

Autotrader Sector Lock - locks a given sector, running this on a locked sector will unlock the sector.
Report Locked Sectors - sends an incoming message with a list of locked sectors.

Known Issues:

Stations that are already locked by UT's will not be handled by this script until the UT unlocks them, they will then be picked up within ~3 minutes of unlocking. This should catch the station before anyone else chooses to lock it. In rare cases you may see a station repeatedly locked by your autotraders, this will delay SectorLock's locking of this station.

Unlocking takes 2-5 minutes to completely unlock a sector. This is caused by the Universe Trader's locking system not by this script.

Works Best With:

gnasirator's mk3 improvement - 100% better function from the mk3.

----

t files/pages used:

Code: Select all

7610 - Autotrader Sector Lock by halo
commands used:

Code: Select all

 <t id="416">COMMAND_TYPE_TRADE_16</t> Autotrader Sector Lock by halo
 <t id="417">COMMAND_TYPE_TRADE_17</t> Report Locked Sectors by halo
Last edited by halo112358 on Fri, 8. Jun 07, 22:08, edited 11 times in total.
*** modified ***

[ external image ]

User avatar
halo112358
Posts: 374
Joined: Thu, 16. Feb 06, 07:56
x3

Post by halo112358 » Tue, 22. May 07, 03:38

Here's what I'm interested in for this release:

Does the script function as expected?
Do you notice any performance hit while using this?
Do you like it?
Do you see any obvious errors?
Is the package complete?
Do sector unlocks happen fast enough for your tastes?
Code Review: Do you see anything stupid?

I wrote this because there's always one sector in my game that's a goddamn UT death trap. Usually there are 3-5 Kha'ak M1 or M2's in it and the stations have the best price in the universe. You can figure the rest out.

I'm going to stress that this is a beta. I've had to rewrite this thing about 3 times to get around the fact that you can't stop a global script by pid. I think I handled concurrency & locking correctly but I'd like for other people to stress test it in case there's something that I missed in my own testing.
Last edited by halo112358 on Tue, 22. May 07, 12:08, edited 8 times in total.
*** modified ***

[ external image ]

User avatar
arcana75
Posts: 2165
Joined: Tue, 2. Dec 03, 09:28
x3tc

Post by arcana75 » Tue, 22. May 07, 03:40

I think u meant spk, xsp is the ship plugin file extension :)

Otherwise, u know, I have never had problems with my traders and my stations. I understand there's a problem with PHQs and UTs but I never leave cash in my PHQ that's prolly why.

Might finally try this with my PHQ sector. :thumb_up:

User avatar
halo112358
Posts: 374
Joined: Thu, 16. Feb 06, 07:56
x3

Post by halo112358 » Tue, 22. May 07, 05:21

arcana75 wrote:Otherwise, u know, I have never had problems with my traders and my stations. I understand there's a problem with PHQs and UTs but I never leave cash in my PHQ that's prolly why.

Might finally try this with my PHQ sector. :thumb_up:
I didn't think of using this on your own sectors. I wrote it because of a Kha'ak invasion in Profit Center Alpha in my current game, my UT's kept trying to trade with the Drone Factory there and I'd lose them about half the time they tried to make a trade run.

During the early game there was nothing I could do about it, it was frustrating to lose ships to something that I knew about but couldn't change.

Now I just lock invaded sectors until I have an M2 ;)
Last edited by halo112358 on Tue, 22. May 07, 11:47, edited 1 time in total.
*** modified ***

[ external image ]

User avatar
arcana75
Posts: 2165
Joined: Tue, 2. Dec 03, 09:28
x3tc

Post by arcana75 » Tue, 22. May 07, 05:50

Ah, so based on ur intention the script is more of a "Temporary No Fly Zone"?

Thus depending on yr implementation it might not necessarily work that effectively as a autotrader restriction script?

User avatar
halo112358
Posts: 374
Joined: Thu, 16. Feb 06, 07:56
x3

Post by halo112358 » Tue, 22. May 07, 06:06

arcana75 wrote:Ah, so based on ur intention the script is more of a "Temporary No Fly Zone"?
Yep, until the sector isn't dangerous any more. You turn it on, all of your UT's will avoid the sector. Later you turn it off and the sector is treated as normal.
arcana75 wrote:Thus depending on yr implementation it might not necessarily work that effectively as a autotrader restriction script?
It's extremely effective at preventing UT's from trading in a locked sector, trust me ;)

Here's how I use it:

Say you have a Kha'ak invasion in a sector, the Kha'ak ships will stay until you've destroyed them (unless the invasion is in a core sector, then the race military might kill them).

Until the Kha'ak have killed all of the stations in that sector you'll have an interesting problem: no traders will be able to navigate the sector and the stations will continue operating. The stations in this sector will have the best buy/sell prices in the universe and your UT's will be drawn to the sector like flies to honey....

In the early game there is nothing you can do about this, except lose ships or try to take on Kha'ak M1's in your M3. You could use the elephant trick to deal with them, but that's gaming the game in it's own way. So why not forbid your UT's from trading in this sector until you can clear it at your leisure?
*** modified ***

[ external image ]

Erilaz
Posts: 161
Joined: Mon, 8. May 06, 13:49
x4

Post by Erilaz » Tue, 22. May 07, 14:12

Great idea. I can think of a few pirate sectors I'd black list, which is in keeping with your original intention.

I must say tho, one of the first thtoughts that occurred to me when reading the description is that I'm also very interested in locking my PHQ sector so the UT's don't steal the Cr when I try to make a new ship. OR clog my PHQ docking ports cos they can't sell when the PHQ doesn't have cash and then don't go about their business, to boot.

I have a CAG on another factory in the same sector. Do you know if this will affect only the UT's and let the CAG's, Commodity Logistics, etc carry on?

User avatar
arcana75
Posts: 2165
Joined: Tue, 2. Dec 03, 09:28
x3tc

Post by arcana75 » Tue, 22. May 07, 14:23

Hmmm I just checked and realised gnasirator's UT script already prevents UTs from trading with the PHQ lol...

jlehtone
Posts: 21801
Joined: Sat, 23. Apr 05, 21:42
x4

Post by jlehtone » Tue, 22. May 07, 14:26

Erilaz wrote:Do you know if this will affect only the UT's and let the CAG's, Commodity Logistics, etc carry on?
I do not think CAG/CLS/EST/??? has anything in common with the UT script. They probably do not touch any UT variables, ever (unless you give them that big stick called "Hammerhead"). :P


Didn't moggy2 wrote a plugin for UT that locks a station, mainly for use with HQ? Naturally, it won't track GoD like this does.

User avatar
halo112358
Posts: 374
Joined: Thu, 16. Feb 06, 07:56
x3

Post by halo112358 » Tue, 22. May 07, 22:16

jlehtone wrote:
Erilaz wrote:Do you know if this will affect only the UT's and let the CAG's, Commodity Logistics, etc carry on?
I do not think CAG/CLS/EST/??? has anything in common with the UT script. They probably do not touch any UT variables, ever (unless you give them that big stick called "Hammerhead"). :P
I don't think this affects the CAG in any way. I'll look and see if I can find out how the CAG handles mutual exclusion on stations - if it's straightforward within the framework I have then I could add support for CAG/CLS.
jlehtone wrote:Didn't moggy2 wrote a plugin for UT that locks a station, mainly for use with HQ? Naturally, it won't track GoD like this does.
Funny story about that script... It runs as a task on one of your own stations and locks one target station. Ever tried to find enough free station tasks to lock an entire sector when you don't have any of your own stations built yet? ;)
*** modified ***

[ external image ]

User avatar
Gazz
Posts: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

Post by Gazz » Tue, 22. May 07, 22:20

halo112358 wrote:I don't think this affects the CAG in any way. I'll look and see if I can find out how the CAG handles mutual exclusion on stations - if it's straightforward within the framework I have then I could add support for CAG/CLS.
CAG use a station script on the last station slot that excludes this station for all CAG.

If you remotely start this script for AI stations, there's your exclusion.
My complete script download page. . . . . . I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.

Erilaz
Posts: 161
Joined: Mon, 8. May 06, 13:49
x4

Post by Erilaz » Wed, 23. May 07, 14:05

Thanks for the tip.

Will use this on those pirate sectors and I'll look for Moggy2's script for the PHQ.

PS: the CAGs etc already prevent themselves going to a sector where there's enemy activity, or is that only pirate activity, not really sure.

jlehtone
Posts: 21801
Joined: Sat, 23. Apr 05, 21:42
x4

Post by jlehtone » Wed, 23. May 07, 15:13

CAG has many options:

* On ship, do not trade with any player station.
* On (player) station, no CAG allowed here (except my own).
* Satellites, only trade in sectors that have some.
* Foe, do not enter sectors owned by enemy race.

Cannot recall if "Trader Barrier" is checked from NPC station.

Actually, since the CAG generates a list of sectors first, overriding that to filter with a blacklist would work nicely, regardless of what stations are in the sector. But that would touch the script. Besides, CAG do behave, usually.

User avatar
halo112358
Posts: 374
Joined: Thu, 16. Feb 06, 07:56
x3

Post by halo112358 » Thu, 24. May 07, 08:10

Hmm. So, has anyone tried the script and liked it?

Usually I only get feedback if there are problems, so I guess I can assume that it's working alright for everyone :D
*** modified ***

[ external image ]

jlehtone
Posts: 21801
Joined: Sat, 23. Apr 05, 21:42
x4

Post by jlehtone » Thu, 24. May 07, 08:49

:oops: Haven't. I have nothing to lock.

mrcann
Posts: 91
Joined: Fri, 27. Apr 07, 18:34

Post by mrcann » Fri, 25. May 07, 01:59

PS: the CAGs etc already prevent themselves going to a sector where there's enemy activity, or is that only pirate activity, not really sure.
i get CAGs trying to trade in sectors with Xenon Invasion and Xenon Taxi all the time. I was already going to patch my CAG script in spare time, to lock down sectors with major enemy activity.

Loosing a UT is ok, as they can be trained relatively quickly and not much profit is lost with their absence, however loosing an Agent hurts very much - cant sell stock, takes forever to train them.

Anyway, if CAGs are included in this package too, that would be really nice ! :)

jlehtone
Posts: 21801
Joined: Sat, 23. Apr 05, 21:42
x4

Post by jlehtone » Fri, 25. May 07, 08:21

mrcann wrote:i get CAGs trying to trade in sectors with Xenon Invasion and Xenon Taxi all the time.
If CAG has both Jumpdrive and Fight Software it will go to dangerous sectors as it thinks it has a "fair chance" to get out of trouble with that equipment. And a sector is "dangerous" whether it has one Pirate Harrier or 11 K and 50 L on rampage.

The latest (unsigned) version of CAG can apparently lock out sectors, if they are owned by enemy race. The signed version does not. Naturally, it makes no sense to turn Argon to Foe on every CAG every time you get XI in Black Hole Sun.

Now here is one idea:
* Multi-sector patrol script command "Add/Remove sector" maintains an arbitrary list of sectors. It is not available on TS ships now, so no conflicts. (Fighter/M6 CAG, well ...)
* Enable that command on TS just to allow "blacklist" management for them.
* Adjust CAG "get-list-of-sectors" to filter with that blacklist. CAG caches the list of sectors, so be smart about getting 'dirty'.
* Adjust CAG report to print out the blacklist too.

And here is another idea:
* Add third option to CAG-Satellites. Currently there are two:
- 0 Satellites ignored
- 1 Trade in sector if sector has satellite
so:
- 2 Do not trade in sector if sector has satellite
* This is a more local change and allows adding a temporary trade barrier beacon on XI/XT sector. Naturally, dropping a satellite into Khaak invaded sector may be futile.
Goner Pancake Protector X
Insanity included at no extra charge.
There is no Box. I am the sand.

RexIG
Posts: 54
Joined: Mon, 30. Jan 06, 07:18
x3

Post by RexIG » Tue, 29. May 07, 11:27

Hi,

i played alot x³ this WE (waiting for Xtended). So i thought i test this script.
I had/have all pirat sector looked because some of my d..n freighters tryed to sell their stuff in Moo Kye´s Revenge :shock:
During the WE i had at least two UTs entering one of these looked sectors (Brennan´s Triumph to be exact). Those two were attacked so i got a message. I can´t say if those were the only ones to enter a "forbiden area" because i don´t keep an eye on my UTs.

I hope this can help you, i really like this script (one more micromanagement pain of my back - more time for hunting pirats :D )
Split Piraten sind die besten:

Split sagen ... AAARRRGHHHHHHH!!!
Spit sagen du jetzt ärger bekommen ... Ich dir geben Schiff!!!
Code:
[ external image ]

User avatar
halo112358
Posts: 374
Joined: Thu, 16. Feb 06, 07:56
x3

Post by halo112358 » Wed, 30. May 07, 10:49

RexIG, you've got PM ;)

~~

Version 1.0 released, debugging is turned off by default.
*** modified ***

[ external image ]

unfunf
Posts: 18
Joined: Sat, 21. Feb 04, 21:48

Post by unfunf » Wed, 30. May 07, 10:56

halo you know what might make sense is a autotrader multi-sector lock based on race.

If you are enemies with a race you could just lock every sector belonging to that race. Of course there would have to be a way to get UTs to jump across those sectors.

Just a thought.

Post Reply

Return to “X³: Reunion - Scripts and Modding”