PSE - Player Station Exchange mod

The place to discuss scripting and game modifications for X²: The Threat.

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

Jonson27
Posts: 170
Joined: Thu, 3. Jun 04, 14:08
x2

PSE - Player Station Exchange mod

Post by Jonson27 » Fri, 17. Apr 09, 07:57

Hello. I started playing x2 in november 08' and bumped into the problem of how to fuel my stations. I wanted to do it myself, so I learned how to script. All in all, the ordeal was fun and rewarding.

AI freighters supplying my factory loop:

My goal was to build a self-sustaining factory loop that did things on its own. Factory loops are like complexes. This means that I could produce products ONLY using player-stations as consumables. Each loop consists of atleast: Solar power plant, Silicon Mine, BoGas factory, Bofu factory, Crystal factory. In my case, I wanted a vegetarian-based loop, so I had to create a boron crystal factory that was for sale in kingdoms end. This loop configuration requires 8 trade runs. In my scripts, a single ship could only be given one trade run, and this rule still stands today. I haven't had the time to go back and add more runs. This means that you have to buy 8 ships to have a fully functioning basic factory loop - it will produce energy cells and you'll get full profits each time you sell them. You don't have to do anything as the ships will move the goods around as you ordered them to.

Locking down the sector and automatically reissuing pse orders:

After getting the scripts to function satisfactorily, I had to confront another problem - unknown enemy ships. It was much too slow to order each of my ships back to base, and then to re-issue the pse orders once the unknown ships were out of range or destroyed. So I added a lockdown command. This would essentially, in a script, automatically order all of my ships to the nearest non-hostile base. If you issue the lockdown order again, it'll remove the lockdown and the ships will be automatically reassigned their previous pse orders. This means that the lockdown command is a toggle and should only used when there're enemy ships in range - or not.

Automatic lockdowns via a Sector Administrator script:

After I had accrued a sizeable income, I made my second factory loop. This was where I bumped into another problem: how to watch two systems at once? Naturally, I also liked to do missions with my private m5. I simply couldn't stay on top of things - the unknown enemy ships would pop up sporadically and surprise me. I realized I needed an automatic test for this in each sector, and when this test condition was true, it would automatically lockdown the appropriate sector. Thus I set out to create Sector Administrators. You'd assign a sector administrator to a non-hostile base in the sector, and the SA would automatically issue the lockdown toggle dependent on whether there's an enemy threat or not. This took a while, but eventually it worked and I could do whatever I wanted in my m5. Furthermore, it allowed me to accelerate time without having to worry about issuing lockdown orders manually.

Cross-sector pse freighters:

After I had played a while, as naturally as the sun will rise, I found myself confronted by another problem. I wanted to be able to move sillicon wafers from one system to a system 2 sectors away where the new factory loop was being built. The problem is that my script was made for single-sector ships. So I had to embark on a quest to create a transport ship that can travel in more than one system. This took me a while, but eventually I got it working. However, I later found a bug where the ship would blow itself up at a gate. Again, after a bit of digging I managed to fix this and it seems to work. There're still limits in it. For example, it's possible that there'll be an enemy ship in the destination sector next to the gate that has NOT been seen by the sector administrator - so the cross-sector transport ship will not know about it because it only checks to see if there's a lockdown or not. This and other constraints I haven't got around to fixing because it takes a lot of time and I'm not up to it.

.................

All of these scripts have been combined into a mod I call the Player Station Exchange. It can be simpliified further to Pl Station Exchange. PSE is an acronym for Player Station Exchange.

These are the commands player-ships have available to them in the command console:
1. Ship->Trade->Pl Station Exchange: Execute Transport Route...
2. Additional Ship Commands->Pl Station Exchange: Assign Sector Administrator To Station...
3. Additional Ship Commands->Pl Station Exchange: Access PSE Command Network...
4. Additional Ship Commands->Pl Station Exchange: Sector Lockdown...

Ship->Trade->Pl Station Exchange: Execute Transport Route...

Code: Select all

This command will assign a ship to a trading route. The requirements are that it must have a player-station homebase, and that the supply station you set is also a player-station. It will also perform miscellaneous checks b4 confirming the command - for example, it'll make sure there's enough cargo room. It will change the name of the ship to reflect the orders - Ex: "12! s2 - 661 Energy Cells for TnG SiliconM 3". "s2" means the ship has a speed of 200-300m. This ship would be working for TnG SiliconM 3 (that's its homebase). It would be transporting 661 Energy Cells from a supplier station to TnG SiliconM 3. "12!" means that this is version 12 of the setroute.std script (this can be removed via a global variable, it's just used for developer purposes).

Arguments:

Supply Station - This is the station which will supply the homebase with a specific product.

Product - This is the product you want the ship to collect for its homebase.

Per Run Amount - This is the number of product you want the ship to deliver on each run. If you enter 0, it'll load as much as will fit in its cargo bay.
Additional Ship Commands->Pl Station Exchange: Assign Sector Administrator To Station...

Code: Select all

This command allows you to hire and assing a SA. Only 1 Sector Administrator can be assigned per sector. They will automatically issue or disable lockdowns when necessary. You may move a sector administrator to a different station by reissuing this command. If the station the SA is located on is destroyed, the sector administrator is removed from duty.

Arguments:

Station - This is the station where you want the SA to conduct his or her operations. When SA's check for an enemy threat, they look look at all pse player stations and pse player ships to see if the enemy is within range.
Additional Ship Commands->Pl Station Exchange: Access PSE Command Network...

Code: Select all

This command gains you access to PSE commands not listed on your ship command list. It uses a text interface via the "Incoming Commands..." routine. You select menu items by entering a number as the input. There're menues within menues that contain the commands. As yet, there's no quickmenu command or favorite command list - this would be a good extra. This was added to reduce the number of commands used by the standard ship command list - there's a limit of about 32 per category. It was primarily done to reduce the likliehood of a command conflict. Ideally, ALL of the commands would be accessed here, but it's a slow interface and unless you have a printout of the menues, it's a pain in the ****.

Arguments:

Argument Type - There're many options, but the most common is to select Number.

Argument Value - This will correspond to the argument type. If you selected a number, then you enter a number.
Additional Ship Commands->Pl Station Exchange: Sector Lockdown...

Code: Select all

This command locks a sector so that all player ships executing the pse transport command are ordered to dock at the nearest non-hostile base. If you re-issue it, ships that were previously docked or ordered to dock will resume their previous orders. (It essentially toggles the lockdown status of a sector.)

Arguments:

Sector - This is the sector which will have its lockdown status toggled.
.................

PSE Command Network Menu(s):
.......... This is the order of the menues and commands that're showed when you use the Pl Station Exchange: Access PSE Command Network... command. Menu items are selected by entering a number when you use this command - instructions are given in "Incoming Message...". Each menu item is followed by its global nav id in paranthesis, which can be entered at any time to access that menu item. Menu items that're menues, not commands, will have "-->" and "..." attached to them. These aren't centered, but the actual menues shown in "Incoming Message..." are centered:

Main Menu:
1 --> Sector Administrator... (n.1)
2 --> Reports... (n.2)
3 --> Settings... (n.3)

Sector Administrator:
1 --> Change Threat Level List... (n.1.1)
2 Toggle Duty Status. (n.1.2)
3 Dismiss. (n.1.3)

Change Threat Level List:
1 Add Race To List. (n.1.1.1)
2 Remove Race From List. (n.1.1.2)
3 Unlisted Races, Current Threat Level: 4. (n.1.1.3)
4 Khaak, Current Threat Level: 2. (n.1.1.4)
5 Xenon, Current Threat Level: 2. (n.1.1.5)

Reports:
1 List Sector Administrators. (n.2.1)
2 List Locked Sectors. (n.2.2)

Settings:
1 Toggle Help Information, Status: ON/OFF. (n.3.1)

Sector Administrator->Change Threat Level List->Add Race To List...

Code: Select all

If you select a ship, this command will add the race associated with the ship to the threat level list with a default threat level of 4.

Arguments:

Ship - The owner race is the race you're going to add.
Sector Administrator->Change Threat Level List->Remove Race From List...

Code: Select all

If you enter the list number or the name of the race, it'll remove it from the threat level list.

Arguments:

Number or String - The number is the threat level list number. Alternatively, you can enter the name of the race as a string.
Sector Administrator->Change Threat Level List->Race, Current Threat Level: 1/2/3/4...

Code: Select all

This will show an input command menu. If you enter a number between 1 and 4, this will change the threat level to this new value. 1 is the highest threat level. 4 is the lowest.

Arguments:

Number - This is the threat level. Must be between 1 and 4.
Sector Administrator->Toggle Duty Status...

Code: Select all

If you select a sector, this command will toggle the duty status of the SA for that sector. If the SA is currently active, then the SA will be off-duty. If the SA is off-duty, thne the SA will be on-duty.

Arguments:

Sector - This is the sector where the SA is stationed.
Sector Administrator->Dismiss...

Code: Select all

If you select a sector, this command will dismiss a SA. This means you're "firing" the sector administrator. (They will be removed from employment.)

Arguments:

Sector - This is the sector where the SA is stationed.
Reports->List Sector Administrators...

Code: Select all

This lists all of the Sector Administrators you've assigned in the x2 universe. It tells you where they're located. It also lists their duty status.
Reports->List Locked Sectors...

Code: Select all

This lists all of the locked sectors in the x2 universe. It also lists how many ships are locked down in each sector - doesn't include cross-sector ships yet.
Settings->Toggle Help Information, Status: ON/OFF...

Code: Select all

This will enable or disable the accompanying help information that's underneath the menu items.
.................

Testing:
I have tested it extensively - relatively speaking from my own perspective. I have 4 factory loops at this point, and 42 ships performing trade runs for them. Most of the ships are single-sector traders, but 2 of them are cross-sector (they work for a silicon mine). The cross-sector scripts are a bit more processor-intensive, but I haven't noticed any major problems.

.................

Future Thoughts:

Quality Control Specialist:
I also wanted to add this. Originally, I wanted the sector administrator to travel between stations and make checkups on your factories. The intent was to have the SA level up and to not only lock the sector when necessary, but also to improve factory efficiency as a result of quality control and oversight. Haven't got this far, nor have I given SA's a salary yet. I could easily justify a salary, but haven't had the interest.

Assign ship to PSE Sector Patrols:
I haven't got around to scripting them. Originally, I had planned on adding PSE Sector Patrols, but it would probably take a month to finish it - so it's something I'm not likely to ever do.

Assign ship to PSE Navcom Duty:
These ships would automatically position a satillite in the sector in a certain position. If the satillite is destroyed, it would automatically reperform the procedure, assuming it has a satillite in its cargohold. It's annoying to have to do this everytime the khaak destroy a satillite.

Assign ship to Cargopod Retreival:
Automatically retrieve cargo in the sector. This could probably be remedied by finding a script somewhere else online instead of doing it myself.

.................

Now, my question. Would anyone be interested to attaining these scripts?

If enough people are interested, I need to know where to put them. I have no experience in distributing mods - in fact, i've never made a mod for a game. I could use some advice. I know that x3 is very popular at this point, and I'm not likely to find any interest, but I had to try. I know that I might have found them usefull, but knowing me, I probably would have tried to code it myself because I hate figuring out other peoples work. But since I'm likely to move on to other things at some point, this might be your only chance to try them out. I know there're a lot of non-programmers out there who don't have the luxury that I do or others do, so there's got to be interest somewhere!

To sum it up... using the scripts is easy. You just copy the scripts into the /scripts folder and copy the template files into the /t folder. The scripts that run on a continual basis will update properly if a new version is made. It's really easy if you've done it b4. I haven't changed any of the data files. The only thing that is really CHANGED is the fact that the setup.vegetarian script will add a boron crystal factory to the boron shipyard in kingdom end. If your universe does not have the kingdom end sector, it will not work and you may not be able to feed your workforce a vegetarian diet - as vegetarian as the boron are anyway.

.................

Here's a list of the applicable pse scripts that're needed, organized by the date that I uploaded them. This is almost like a changelog history:

5/13/09

Code: Select all

15,282  02-20-09  7:38a pse.report.sctradmn.list.xml
24,809  01-16-09 11:07p misc.time.get.curdate.xml
25,807  05-13-09  8:49a pse.glbl.racethreatlvl.add.xml
18,732  05-10-09  5:05a pse.glbl.racethreatlvl.set.xml
18,988  02-20-09  7:44a pse.glbl.sctradmn.add.xml
11,633  02-20-09  8:41a pse.glbl.sctradmn.del.xml
8,536  02-20-09  7:47a pse.glbl.sctradmn.get.xml
5,673  01-22-09  3:13a pse.glbl.sctradmn.set.xml
8,663  05-07-09  9:25a pse.glbl.sys.menu.get.curr.xml
10,211  05-07-09  9:39a pse.glbl.sys.menu.get.xml
7,919  02-11-09  9:07a pse.lib.restart.xml
119,451  05-10-09  5:06a pse.loop.sctradmn.xml
63,038  04-24-09  1:53a pse.loop.transportroute.ext.xml
42,287  04-18-09  5:59a pse.loop.transportroute.xml
10,302  01-11-09  3:22a pse.misc.sort.insertion.d0.xml
12,968  01-11-09  3:38a pse.misc.sort.insertion.d1.xml
9,185  01-11-09  3:14a pse.misc.sort.insertion.xml
12,100  02-20-09  7:39a pse.report.lockdown.list.xml
13,260  01-16-09 11:22p misc.time.get.curdate.string.xml
52,527  02-20-09  1:44p pse.ship.cmd.lockdown.xml
18,609  04-23-09  8:47p pse.ship.cmd.setroute.std.pre.xml
70,518  04-24-09  1:36a pse.ship.cmd.setroute.std.xml
2,314  12-26-08  4:53p pse.ship.cmd.setroute.xml
141,100  05-13-09 12:36p pse.ship.cmd.sys.menu.xml
35,323  04-24-09  1:17a pse.ship.signal.lockdown.pre.xml
45,145  04-24-09  1:18a pse.ship.signal.lockdown.xml
20,043  02-10-09 12:41p pse.station.cmd.assign.admin.xml
7,119  01-30-09 12:46a pse.station.signal.killed.xml
102,869  05-13-09 11:56a setup.pse.xml
12,341  12-31-08 11:00p setup.vegetarian.xml
30 file(s)        946,752 bytes
4/17/09

Code: Select all

PSEMIS~1 XML 10,302 01-11-09 3:22a  pse.misc.sort.insertion.d0.xml
24,809 01-16-09 11:07p  misc.time.get.curdate.xml
18,988 02-20-09 7:44a  pse.glbl.sctradmn.add.xml
11,633 02-20-09 8:41a  pse.glbl.sctradmn.del.xml
8,536 02-20-09 7:47a  pse.glbl.sctradmn.get.xml
5,673 01-22-09 3:13a  pse.glbl.sctradmn.set.xml
8,653 01-28-09 4:12a  pse.glbl.sys.menu.get.xml
7,919 02-11-09 9:07a  pse.lib.restart.xml
88,141 02-20-09 8:44a  pse.loop.sctradmn.xml
56,795 02-20-09 4:43p  pse.loop.transportroute.ext.xml
42,287 02-16-09 5:14p  pse.loop.transportroute.xml
13,260 01-16-09 11:22p  misc.time.get.curdate.string.xml
12,968 01-11-09 3:38a  pse.misc.sort.insertion.d1.xml
9,185 01-11-09 3:14a  pse.misc.sort.insertion.xml
12,100 02-20-09 7:39a  pse.report.lockdown.list.xml
15,282 02-20-09 7:38a  pse.report.sctradmn.list.xml
52,527 02-20-09 1:44p  pse.ship.cmd.lockdown.xml
18,063 02-20-09 4:38p  pse.ship.cmd.setroute.std.pre.xml
64,309 02-20-09 11:24a  pse.ship.cmd.setroute.std.xml
2,314 12-26-08 4:53p  pse.ship.cmd.setroute.xml
64,839 01-31-09 5:03a  pse.ship.cmd.sys.menu.xml
33,422 02-20-09 5:37p  pse.ship.signal.lockdown.pre.xml
36,396 02-19-09 10:37a  pse.ship.signal.lockdown.xml
20,043 02-10-09 12:41p  pse.station.cmd.assign.admin.xml
7,119 01-30-09 12:46a  pse.station.signal.killed.xml
52,795 02-21-09 12:04p  setup.pse.xml
12,341 12-31-08 11:00p  setup.vegetarian.xml
(27 file(s)        710,699 bytes)
Just one *.t file is used.

.................

Here is a review of PSE features (or problems):

1. Ships are limited to a single trade run that they'll do indeffinately
3. Sector Administrators can automatically dock ships if there's a threat
4. Sector Administrators will automatically reissue commands after a threat is removed or cleared
5. Ships can perform trade-runs that're cross sector - more than one sector
6. Ships do not have jump functionality
7. Ships do not check for enemies on their own - need a SA (possible problem)
8. If a lockdown is issued, ships will not use gates, even if they're closer, they will instead dock at the nearest base (problem)
9. Enemy threats are based on the original x2 - there is no ability to change enemy threats at this point in time (like if you add a new race). This means the SA might not issue a lockdown if the enemy is not an original race. (problem) - FIXED
10. Sector Administrators do not check gates for enemy threats, yet. This means that cross-sector ships can potentially gate into a sector and get eaten up by nearby enemies - like khaak. (problem)

Thanks for visiting.
Last edited by Jonson27 on Thu, 14. May 09, 10:14, edited 39 times in total.
Hello there!! (Jumping up and down)

User avatar
Chris Gi
Posts: 960
Joined: Wed, 20. Sep 06, 09:57
x3tc

Post by Chris Gi » Fri, 17. Apr 09, 08:48

Sounds very interesting. A good alternative to the other loop scripts around, especially for more careful players who don't want to loose their ships.

I'm always interested in scripts like this.
They come along with potential bugs.
Like any other new script package.
If enough people are interested, I need to know where to put them.
You can send the script package to me. I have a small web space that can easily host this package. And maybe you can ask Baubsmyth, the real X2 Archiver.
The only thing that is really CHANGEd is the fact that the setup.vegetarian script will add a boron crystal factory to the boron shipyard in kingdom end. If your universe does not have the kingdom end sector, it will not work
Why this restriction? You should be able to use this on any map you like (as long as there are any boron shipyards at all).
--------------------------------

[ external image ]

Jonson27
Posts: 170
Joined: Thu, 3. Jun 04, 14:08
x2

Post by Jonson27 » Fri, 17. Apr 09, 09:03

Chris GI wrote:Sounds very interesting. A good alternative to the other loop scripts around, especially for more careful players who don't want to loose their ships.
That's one of the benefits. I haven't lost a single ship. However, this is partly due to my factory loop design...

It looks like this (numbers are z coordinate):

Code: Select all

-2 -6 +2
+6 +0 +6
+2 -6 -2
It would be nice to have a script to automatically place the stations this way. I had to build 2 factory loops b4 I figured out how it works.. so my 3rd is clean and sharp.

The stations are real close to one another. Cross-sector pse traders could still use some extra coding to prevent mishaps. Still, in most cases, as long as you think ahead, it works fairly well.
Chris GI wrote:You can send the script package to me. I have a small web space that can easily host this package. And maybe you can ask Baubsmyth, the real X2 Archiver.
I will consider that if I get any interest here.
Chris GI wrote:
The only thing that is really CHANGEd is the fact that the setup.vegetarian script will add a boron crystal factory to the boron shipyard in kingdom end. If your universe does not have the kingdom end sector, it will not work
Why this restriction? You should be able to use this on any map you like (as long as there are any boron shipyards at all).
Hmm. Currently, the setup.vegetarian goes through the entire universe and looks for "kingdoms end". If it finds it, it adds the crystal fab. I could change it to add it when it's a boron sector and has a shipyard, but would have to take a look.
Last edited by Jonson27 on Sun, 19. Apr 09, 09:47, edited 4 times in total.
Hello there!! (Jumping up and down)

Jonson27
Posts: 170
Joined: Thu, 3. Jun 04, 14:08
x2

Post by Jonson27 » Sun, 19. Apr 09, 09:29

Made a slight modifation to the scripts yesterday. When ships are locked down, they'll now continue to load product, but only if they're docked at the supply station - this doesn't always happen. They'll load as much as they can fit. Before they'd just sit there until the lockdown was cancelled - often times product would get purchased by non-player traders even though the product was set to max price.
Last edited by Jonson27 on Fri, 24. Apr 09, 12:00, edited 1 time in total.
Hello there!! (Jumping up and down)

Jonson27
Posts: 170
Joined: Thu, 3. Jun 04, 14:08
x2

Post by Jonson27 » Fri, 24. Apr 09, 11:37

Fixed a bug in the cross-sector trader - think i did anyway. The cross-sector traders weren't able to determine whether a sector was locked or not in infrequent circumstances. I rearranged the code some and hopefully it's more bug-proof now.

Added a global debug variable that can update scripts - they'll restart if the debug state changes. For now it just works for turning off the version # in pse ship names.

Changed PSE ship names to "<version>! <ship speed> - <# of ware> <ware name> for <station name> [lockdown status]". The <version> is the version number for the setroute command. Example: "14! s2 - 661 Energy Cells for TnG SiliconM 3". Or "14! s2 - 661 Energy Cells for TnG SiliconM 3 [PRE-LOCK]". Or "14! s2 - 661 Energy Cells for TnG SiliconM 3 [LOCKDOWN]". The version number can be shut off by changing a global variable (pse.global.debug) in setup.pse to 0. Setting it to 1 will turn it on.


Some future work I have planned is to make it so that the race threat level can be changed via the PSE Command Network menu(s). Right now it's hardcoded and only the khaak or xenon will trigger a lockdown. I encountered a problem with the pirates and pretty much realized that this mod can't be released to others until I resolve this problem. There're 4 threat levels. Here're my ideas for them:

Threat Level 1 - If the enemy is found anywhere in the sector then a lockdown will be issued. There're no conditions other than a presence. When the enemy is no longer present in hte sector then the lockdown will be lifted.
Threat Level 2 - If the enemy is within 35km of a player station or a player pse trader ship then a lockdown will be issued. The lockdown will not be removed until the enemy is outside of 45km of any player station or pse trader ship (including the position where the threat was initially discovered).
Threat Level 3 - If the enemy is within 25km of a player station or a player pse trader ship then a lockdown will be issued. The lockdown will not be removed until the enemy is outside of 35km of any player station or pse trader ship (including the position where the threat was initially discovered). This is just like threat level 2, but with reduced distances.
Threat Level 4 - If the enemy is within 25km of a player station or a player pse trader ship AND the enemy has engaged a player pse asset, then a lockdown will be issued. If the enemy has not engaged a player asset BUT is within 10km of a player pse asset, then a lockdown will be issued. The lockdown will not be removed until the enemy is outside of 25km of any player station or pse trader ship (including the position where the threat was initially discovered).

All that I need to do is allow the player to link a race to whatever threat level they feel is appropriate. For now I won't even worry about allowing the player to change the conditions of each threat level. It's enough work just to add the ability to change it. It will mean a substantial overhaul of the menues too. I gotta add hte ability so that you can enter a shortcut value for each menu item from anywhere in the network. This way you could enter "nav.1.1", if you want to toggle the duty status for a SA, for example.

I have to say that through all my time making scripts, the biggest complaint I have is the script editor. It's horrible horrible. I know that the script editor is in addition to everything else, but it's still incredibly discouraging to use it. It's like scraping pins and needles across your face or pulling your eyeballs out of their sockets. If they ahd made a better script editor, I bet we'd have more scripts available - and they'd probably be higher quality. I know that I'd have a lot more done.
Hello there!! (Jumping up and down)

Jonson27
Posts: 170
Joined: Thu, 3. Jun 04, 14:08
x2

Post by Jonson27 » Sun, 3. May 09, 11:43

Update...

I'm working on allowing the player to change the threat levels for races. I'm also going to make it so that you can add additional races to the threat list. The player can also access any menu item within the PSE network by entering its id, like "n.1.1.1" or "n.1.2". So the readme will have a full list of the menu items in the PSE network... If you print them it's much easier to navigate the menues this way than it's to navigate them manually.

And the biggest thing for me is to make sure that if I ever made an update to this that others can use it if they already have it installed. That's very important because I wouldn't want people losing saved games or in-game settings.

I think it'll probably be done in another week maybe, depending on whether I can get myself into x2 to finish this. Maybe I can make this mod downloadable in a few weeks, but my best guess is less than a month. It really depends because I may bump into something else that needs to be added or fixed. I'll also make a readme available that's much simpler than my first post in explaining how to use the PSE mod. It's very very simple. The hardest part is knowing how to play x2.
Hello there!! (Jumping up and down)

User avatar
Lord Dakier
Posts: 3243
Joined: Fri, 8. Dec 06, 13:45
x4

Post by Lord Dakier » Sun, 3. May 09, 14:12

Wow, hold on a quinky dink. So I could make the Khaak my ally and everyone else enemies for example?

Jonson27
Posts: 170
Joined: Thu, 3. Jun 04, 14:08
x2

Post by Jonson27 » Tue, 5. May 09, 18:29

Lord_Dakier wrote:Wow, hold on a quinky dink. So I could make the Khaak my ally and everyone else enemies for example?
Sorry, you're mistaken. This only applies to the conditions upon which the sector administrator relies to determine whether a sector lockdown is issued. It's all script-side... no effect on actual relationships in-game.

As for your issue, I'm unsure. You probably would have to change the x2 data files so the khaak won't attack you, but that might not be possible unless you change your race to xenon. After you do that, just make the rest of the races enemies in-game. It seems like there should be a way to do it.

I wish there was a way to do it, but the xenon might be hostile to everyone. It might be hardcoded that way :/

Someone on this forum should know.
Hello there!! (Jumping up and down)

User avatar
Lord Dakier
Posts: 3243
Joined: Fri, 8. Dec 06, 13:45
x4

Post by Lord Dakier » Tue, 5. May 09, 18:55

Its possible lol, I know it is possible. 100% sure lol.

If you look in the galaxy editor they are frendlies so I should imagine it is possible.

Jonson27
Posts: 170
Joined: Thu, 3. Jun 04, 14:08
x2

Update

Post by Jonson27 » Wed, 13. May 09, 21:55

You can now change the threat levels for all races using hte pse command network (accessible via the associated ship command). You can also add additional races that're not listed by default by using the "Add Race To List" command. It works by you selecting a ship as input and then getting the owner race of the ship. You may also set the threat level for 'Unlisted Races'.

I simplified the 4th threat level so that the only difference between it and the others is that its distance is reduced. I can maybe improve it at a later time. One possible improvement is to only respond at certain ranges when the enemy ship attacks a pse asset.

Made a slight modification so that enemy TS/TP ships won't trigger a lockdown. This could also be modified later to handle situations where the TS or TP ship is attacking a pse asset - this has never happened in my experience.

Added a pse network command which will toggle the help information on/off. The help information is displayed below the menu items, if it's enabled.

All commands in the pse network can be accessed at any point by giving the pse network ship command a string input; ex: "n.1.1.1" will access the command that can add a race to the threat level list. This works best if a printout of the menues is available - but it's easy to memorize since there're not very many menu items yet.

Fixed some bugs in the sector administrator script. One of them was needlessly looping the procedure that makes the threat ship array. Another one didn't correctly compare the current ship with the previous ship - which would have limited the ability to properly assess the threat.


That's all I can think of at the moment. I still need to add a command to delete a race from the threat list. But since I've already added the ability to add... and have the framework built... it's considerably easier. I'd also like to add the lockdown command to the pse network and experiment with that to see whether I can remove it from the ship commands without losing too much convenience. And there're various other things on my mind.

I'll play with these modifications for a while. Maybe long enough to buy an m2. There's some more mining I want to do as well. Also want to try to capture more ships - I've just barely touched on that. I could also build more factory loops or complexes, whichever they're called. That way I maybe can get an idea how much stress the script engine can tolerate. Then I'll see about making this public. Not sure when that'll be, but maybe less than a month.

I don't wanna release something too crappy, but there're things I won't figure out until it's released. Originally, I wanted to release this thing, bugs and all, but after playing with it for a while, I'm glad I didn't. It's hard to resist adding things to it, but I need to if I ever wanna release it. Gotta focus on eliminating bugs. I know there're not many people playing x2 anymore, but I've enjoyed making these scripts, and I'm almost certain someone out there could use em. In that case, I want to have something available that works well and doesn't have any monolithic shortcomings.

Here's an updated file list:

Code: Select all

15,282  02-20-09  7:38a pse.report.sctradmn.list.xml
24,809  01-16-09 11:07p misc.time.get.curdate.xml
25,807  05-13-09  8:49a pse.glbl.racethreatlvl.add.xml
18,732  05-10-09  5:05a pse.glbl.racethreatlvl.set.xml
18,988  02-20-09  7:44a pse.glbl.sctradmn.add.xml
11,633  02-20-09  8:41a pse.glbl.sctradmn.del.xml
8,536  02-20-09  7:47a pse.glbl.sctradmn.get.xml
5,673  01-22-09  3:13a pse.glbl.sctradmn.set.xml
8,663  05-07-09  9:25a pse.glbl.sys.menu.get.curr.xml
10,211  05-07-09  9:39a pse.glbl.sys.menu.get.xml
7,919  02-11-09  9:07a pse.lib.restart.xml
119,451  05-10-09  5:06a pse.loop.sctradmn.xml
63,038  04-24-09  1:53a pse.loop.transportroute.ext.xml
42,287  04-18-09  5:59a pse.loop.transportroute.xml
10,302  01-11-09  3:22a pse.misc.sort.insertion.d0.xml
12,968  01-11-09  3:38a pse.misc.sort.insertion.d1.xml
9,185  01-11-09  3:14a pse.misc.sort.insertion.xml
12,100  02-20-09  7:39a pse.report.lockdown.list.xml
13,260  01-16-09 11:22p misc.time.get.curdate.string.xml
52,527  02-20-09  1:44p pse.ship.cmd.lockdown.xml
18,609  04-23-09  8:47p pse.ship.cmd.setroute.std.pre.xml
70,518  04-24-09  1:36a pse.ship.cmd.setroute.std.xml
2,314  12-26-08  4:53p pse.ship.cmd.setroute.xml
141,100  05-13-09 12:36p pse.ship.cmd.sys.menu.xml
35,323  04-24-09  1:17a pse.ship.signal.lockdown.pre.xml
45,145  04-24-09  1:18a pse.ship.signal.lockdown.xml
20,043  02-10-09 12:41p pse.station.cmd.assign.admin.xml
7,119  01-30-09 12:46a pse.station.signal.killed.xml
102,869  05-13-09 11:56a setup.pse.xml
12,341  12-31-08 11:00p setup.vegetarian.xml
30 file(s)        946,752 bytes
Here's the old one from almost a month ago:

Code: Select all

10,302 01-11-09 3:22a  pse.misc.sort.insertion.d0.xml
24,809 01-16-09 11:07p  misc.time.get.curdate.xml
18,988 02-20-09 7:44a  pse.glbl.sctradmn.add.xml
11,633 02-20-09 8:41a  pse.glbl.sctradmn.del.xml
8,536 02-20-09 7:47a  pse.glbl.sctradmn.get.xml
5,673 01-22-09 3:13a  pse.glbl.sctradmn.set.xml
8,653 01-28-09 4:12a  pse.glbl.sys.menu.get.xml
7,919 02-11-09 9:07a  pse.lib.restart.xml
88,141 02-20-09 8:44a  pse.loop.sctradmn.xml
56,795 02-20-09 4:43p  pse.loop.transportroute.ext.xml
42,287 02-16-09 5:14p  pse.loop.transportroute.xml
13,260 01-16-09 11:22p  misc.time.get.curdate.string.xml
12,968 01-11-09 3:38a  pse.misc.sort.insertion.d1.xml
9,185 01-11-09 3:14a  pse.misc.sort.insertion.xml
12,100 02-20-09 7:39a  pse.report.lockdown.list.xml
15,282 02-20-09 7:38a  pse.report.sctradmn.list.xml
52,527 02-20-09 1:44p  pse.ship.cmd.lockdown.xml
18,063 02-20-09 4:38p  pse.ship.cmd.setroute.std.pre.xml
64,309 02-20-09 11:24a  pse.ship.cmd.setroute.std.xml
2,314 12-26-08 4:53p  pse.ship.cmd.setroute.xml
64,839 01-31-09 5:03a  pse.ship.cmd.sys.menu.xml
33,422 02-20-09 5:37p  pse.ship.signal.lockdown.pre.xml
36,396 02-19-09 10:37a  pse.ship.signal.lockdown.xml
20,043 02-10-09 12:41p  pse.station.cmd.assign.admin.xml
7,119 01-30-09 12:46a  pse.station.signal.killed.xml
52,795 02-21-09 12:04p  setup.pse.xml
12,341 12-31-08 11:00p  setup.vegetarian.xml
(27 file(s)        710,699 bytes)
And I have a question, chris gi or whoever reads this.... How common is it for people to change the preconfigured races or to add new ones? Will the race constants still work? For example, if I'm referencing the "Argon" race-type constant, will it bug the script engine if the "Argon" don't exist in a custom universe? This is one of hte reasons I wanted to add the ability to add/delete races - in case people added races or deleted the default x2 races.
Hello there!! (Jumping up and down)

User avatar
Chris Gi
Posts: 960
Joined: Wed, 20. Sep 06, 09:57
x3tc

Post by Chris Gi » Thu, 14. May 09, 23:17

How common is it for people to change the preconfigured races or to add new ones?
From a scripter's point of view, there's nothing to take care of here. The "Argon Race" is just the race with the ID 0. You can rename the race, it's still the race with ID 0. It's very much like the commands - they're built into the game, and you can rename them, but the underlying identifier doesn't change.
And it's not very common to change races, anyway.
--------------------------------

[ external image ]

User avatar
Lord Dakier
Posts: 3243
Joined: Fri, 8. Dec 06, 13:45
x4

Post by Lord Dakier » Thu, 14. May 09, 23:56

I'm surprised that the feature of changing the race names was not abused by every modder out there to be honest.

Jonson27
Posts: 170
Joined: Thu, 3. Jun 04, 14:08
x2

Post by Jonson27 » Fri, 15. May 09, 12:04

Chris Gi wrote:
How common is it for people to change the preconfigured races or to add new ones?
From a scripter's point of view, there's nothing to take care of here. The "Argon Race" is just the race with the ID 0. You can rename the race, it's still the race with ID 0. It's very much like the commands - they're built into the game, and you can rename them, but the underlying identifier doesn't change.
And it's not very common to change races, anyway.
If I reference the "Argon" race-type constant, it will alway work then? Like: "$ar.race[0] = Argon". I was worried that "Argon" or other vanilla x2 race constants might not be recognized in some custom universes.

It's not possible to add additional races? Some races have generic names like "neutral race" or enemy race".

Is it possible to change hte name of the races in scripts.. or do you have to do that in the cab/dat files? I'm assuming you'd have to change the cat/dat files because of the race-type constants like "Argon".
Hello there!! (Jumping up and down)

User avatar
Lord Dakier
Posts: 3243
Joined: Fri, 8. Dec 06, 13:45
x4

Post by Lord Dakier » Fri, 15. May 09, 12:25

You can change Races 1-3 but not friendly, enemy or neutral I dont think. I am also sure that name changes must be done in the text files.

User avatar
Chris Gi
Posts: 960
Joined: Wed, 20. Sep 06, 09:57
x3tc

Post by Chris Gi » Fri, 15. May 09, 15:07

Jonson27 wrote:If I reference the "Argon" race-type constant, it will alway work then?
Yes. The races are a built-in feature. You can't remove them from the game unless you change the game. What you see in a script as "Argon", is just something like "Race 0". You can rename the Argon race to "My silly race name", and the script will deal with the same race as before. The only difference is it is named "My silly race name". And if your script is edited in such a universe, the line would read "$ar.race[0] = My silly race name". It's still the same object, but referenced by the new name.

Of course you could build a universe that doesn't have any stations, ships and sectors that belong to the Argon race. That's the only way to "remove" a race.

If you know OOP (Object-Orientated Programming): I tend to think of this classes when I deal with such stuff (I don't know if it's implemented that way, but it seems to be). There's a class race, and we have 20 instances of this class: Race_Argon, Race_Boron, Race_Race1 and so on. A property of this class is "name": Argon, Boron, My silly race name... None of these 20 instances can be removed from the game, but in vanilla X2 there's no reference of the classes Race_Race1, Race_Race2....

Races like "Friends", "Enemies" are obviously abstractions, dealing with the "Relation" property.

You can't add another race to the game, but give life to those unused races Race1-Race5. But there can't be done much with these races anyway...

Like Lord_Dakier said, name changes must be done in the text files. But you just change the name property of the race, not the race itself. Scripts work with the race object - thus you don't need to worry about the missing or additional races.
--------------------------------

[ external image ]

Jonson27
Posts: 170
Joined: Thu, 3. Jun 04, 14:08
x2

Post by Jonson27 » Sat, 16. May 09, 20:35

Finished adding the "Remove Race From List" command.

Completed full global access to all menues and commands via "n.#..."

Fixed an issue with the lockdown command by preventing the player from locking a sector in the instance that a SA is on-duty in that sector. All it would do is b4, expectantly, is cause the SA to reverse the lockdown orders immediately afterwards. To lock a sector that's being managed by a SA, the player must either dismiss the SA or change their duty status to off-duty.

Added a change that should allow me to later add cross-sector ships to the listed locked ships in the lockdown list.


I'll be playing for a while to debug and build my empire. One thing I might add is a menu and menu items for changing the lockdown conditions, one of which will be disabling the setting that ignores TS/TP craft when assessing the threat. I may also add the lockdown command to the pse network instead - which will free up a ship command id so that conflicts with other mod(s) or scripts is less likely. I may also explore the possiblity of moving the "Assign Sector Administrator to Station..." command to the pse network too. The end result will be only two commands that're ship commands; ships commands tied to the IDs, 0-31 range for each command category.

Anyone have any suggestions? I've been thinking about adding a salary for sector administrators, but I'm weary of doing so. It would happen on a set level of time... maybe 30 mizura. Another thing I could do is charge more when sector administrators are roomed on non-player stations - this would account for boarding costs. This often happens when you're doing cross-sector trading over a length greater than 2 sectors. It depends. It would also be nice if sector administrators could periodically find surplus product as a supplement to their normal duties as security officers. The chance for this might be affected by their length of employement. All of this is very speculative, however.

Another idea is to add dynamic menues for adding gates to the lockdown conditions. This would prevent the possiblity of cross-sector ships gating into a sector and being ambushed by khaak because the SA doesn't look at gates; at the present time. I might also consider allowing cross-sector ships to do this automatically if there's an SA in the next sector, but I haven't made up my mind. So far I haven't lost a cross-sector ship, but the possibility of a loss remains.

I won't likely be including any of this in the first public release. Right now it's just thoughts... debugging all of it and getting it to work well requires a lot of time. I've programmed enogh to know that what you think will take a couple days will end up taking almost a week. The time for release would be pushed back another month with more features. But, on the other hand, there doesn't seem to be much interest yet. But maybe I just need to release something first, to find out?? Not releasing this should be a crime... lol. I will release it.... after killing off some more khaak and proving I can manage a small empire.
Hello there!! (Jumping up and down)

User avatar
Lord Dakier
Posts: 3243
Joined: Fri, 8. Dec 06, 13:45
x4

Post by Lord Dakier » Sun, 17. May 09, 05:06

Glad to see you got this to a testing phase.

Jonson27
Posts: 170
Joined: Thu, 3. Jun 04, 14:08
x2

Post by Jonson27 » Sat, 23. May 09, 22:35

I haven't had any major problems. Ofcourse, there's still a long list of things that could be improved, but... Right now I'm just playing when I feel like it. I'll probably upload it soon... but i'm goina sit on it.

One thing that bugs me is how this thing is going to compete with the complex mod. It's more time consuming to use because you need to buy the ships and give them orders. It uses more cpu cycles because it needs to protect the ships from being blown up by enemy ships, and the ships themselves need scripts to trade. On the other hand, it doesn't depend on superduper goner magic. My mod might be more appealing to those who don't like hte goners. The complex mod removes ships from the equation, and there's no other example of it in x2 - all of the stations use ships. Still, not a single non-player uses PSE, either. So the same can be said about it. Blah blah. I can't think of any solid reasoning that says this mod can compete with it.

I've thought that maybe hte sector administrator could be more personalized... there's lots of things I can think of, but right now I am not very enthusiastic about coding further. Releasing it as is might be best.

Some ideas for later reference:
1) Add a salary for the sector administrator
2) Add a profile command for hte sector administrator that displays their work history and abilities
3) A report that shows the lockdown history for a sector
4) Add abilities like quality control, accounting, factory efficiency, and other abilities to the SA, which can be learned by the SA or trained
5) Add pse patrols that're given orders by the SA
6) Add pse navcom ships for deploying sector satillites

Other ideas I have are for another mod really.
Hello there!! (Jumping up and down)

Jonson27
Posts: 170
Joined: Thu, 3. Jun 04, 14:08
x2

Post by Jonson27 » Mon, 25. May 09, 18:40

I've decided to maybe make a few additions/changes b4 uploading the mod. I'm not sure how long this will take, but I feel I should do this. I want to account for the gain that's apparent by including costs. Everything costs something! While the costs will be noticeable at first, they'll decline as working efficiency improves.

B4 anything else, the SA needs a name and a race. Lol. Right now the SA is nameless... might as well be a peice of code (which he is).

First, I'm going to require a ware to use the PSE network command(s). I'm going to use SS_WARE_SW_NEW7 - about 10724 credits. This is what you need to use the mod. For just the basics of a factory loop you need a SPP, a silicon mine, a raw food factory, a food factory and a crystal factory. That requires about 8 ships - so that will add up to over 85,000 credits for a basic loop in ship command costs. This basic loop would produce about 1500+ credits per mizura.

Second, to gain access to the sector administrator, which is what will keep your ships safe, you need to assign one, but there're a few things to consider. First, there's an upfront cost, one-time only, of 100,000 credits to pay for the necessary equipment, needed office room to house the administrator and those that might work for him/her, and funds that're required by the PSE network employees that oversee sector administrator employment activities. Second, if you post the administrator on a non-player station there will be an additional one-time only cost of 25,000 credits to pay a down payment made mandatory by the station owners.

Thirdly, there're costs associated with the continued use of the PSE. These costs are distributed among several venues: wages for the sector administrator and his/her employees, miscellaneous maintenance and oversight, periodic fees for the use of the network, and payments to the station tenants, if the sector administrator and those who work with him/her are located on a non-player station. These fees, altogether, are expensive at first. It's on the order of 1000 credits per mizura, initially. That's almost half the profit of a factory loop. These periodic fees, over time, will reduce to an average of about 300 credits per mizura due to employee experience and efficiency gains in other areas. This time span should be relatively short, but long enough that it feels like the pse operations are being "trained" - as though they're learning. This way it's like an investment.

I'm also thinking about allowing training between the administration of one sector and another. For example, you might use the expertise of one sector to train the skill of another. This would mean that costs would go down quicker.

The natural inclination will be to build lots of factory loops in one sector, but this will still incur some additional charges... each ship running the pse command charges a small flat fee everytime it docks at its homebase or its destination, for example. This would still be more profitable than building in several sectors. It's profitabe for other reasons as well. For example, the sector may already have patrols (like argon prime or the ore belt). However, as they say, it's not a good idea to put all your eggs in one basket. If you install a mod that increases hostillities with the khaak or some other hostile race, you may put yourself into a vulnerable position.

These are my initial thoughts. I said I wouldn't do this, but ... right now there's next to no strategy involved. I don't have to think about where i put things or how i set them up - it's not fun. It's easy, but not fun. It makes using the scripts very boring. I don't want the scripts to be tedious, I just want them to be something where you have to think about it, like when you first build it, but after that it's not needed. The scripts also feel impersonal. They're robotic and empty. I don't feel any intimacy with the operations or the SA, and that bothers me. I want to feel like a soldier going out to battle enemies... all the while, knowing I have "family" back home. Hehe, I know that sounds corny, but .... maybe part of it's that i want to have a relatonship with the pse operations, and right now there's none.

Another reason for doing this is to work with time. I haven't worked with time yet. I have a couple routines for doing it, but haven't implemented anything. Simplest thing I could do is give an employment date for the SA. More complicated would be to make a report that lists the total lockdown time by sector (the ore belt, btw, has a lot of lockdowns).
Hello there!! (Jumping up and down)

Jonson27
Posts: 170
Joined: Thu, 3. Jun 04, 14:08
x2

Post by Jonson27 » Mon, 25. May 09, 19:36

And one another thing... I've been thinking about coding a ship reserve script. When a ship is destroyed, for whatever reason, it'll try to replace it by employing a reserve ship. The reserve ships can be added by you to a list. I'm not sure how the lists themselves will be organized, but this would virtually ensure no possibility of a break in automation, unless a station was destroyed or somehow an enemy managed to evade threat detection.
Hello there!! (Jumping up and down)

Return to “X²: The Threat - Scripts and Modding”