Page 1 of 14

[SCR/MOD] Complex Cleaner v3.20 / Modular Complexes

Posted: Fri, 2. Mar 07, 00:10
by Gazz
(Das entsprechende deutsche Topic ist hier.)

Complex too big? FPS too low? Don't like italian food?

1.Image 2.Image 3.Image 4.Image
  1. This is a complex I scripted in merely for the picture.
    There are 20 Biogas L, 15 Crystal Fab M, 10 SPP M.
  2. The same complex crunched. (Model by KilleRTidE)
    Note that this is one station in the game. It's just a big one. =)
    1 + 2 were taken from the exact same position and orientation.
    The difference in FPS is quite noticable and they do not get much lower when the Module Complex grows.
  3. The internal wiring is done exteremely efficiently, reducing the number of tubes to an absolute minimum.
  4. Not only does your complex become neater - it is easier to manage, too.
    Imagine having 45 single factories in that list instead of 4.
This is the first real "complex FPS issue" script/mod that still has working factories with all proper interface items, such as ware storage and production bars.

Scripts for the complex builder: ComplexCleaner v2, Condense Asteroids, Super Tractor, A.R.E.S. Station Building


A Tractor Beam must be on board of the executing ship.

The script has 2 arguments.
  • Command (text) : This is what the script is supposed to do.
    Position (Position) : When things are moved or built somewhere, this is always where they are put.

  • crunch : All unconnected factories and mines in the sector are combined into as few as possible factory modules.

    If this command is run for the first time, the Module Complex is built at the position you supplied.
    Watch where you build it. This thing is huge.
    On subsequent crunch runs the position argument is ignored and the Factory modules automatically added to an existing Module Complex.

    Ships can not dock at a Factory Module. FM can only function as part of a complex.

    You still need to connect the "crunched" Factory Modules. manually. However, it's a whole lot faster to connect 4 Factory Modules instead of 45 single factories. =)

    You are allowed to connect the Module Complex to the hub but if you do so, it's very likely that the hub will be destroyed the next time you run the crunch command. Your decision.
    The factory modules ( =real producing factories) are the ones you are supposed to connect.

    Factories of every possible type or size will be assimilated into standardized Factory Modules with possible sizes of
    1 (S), 2 (M), 5 (L), 10 (XL), 20, 40, 50, 100, 150, and 200.

    Ore and silicon mines can not be crunched without a small loss. I have seen 1-4 %. This is due to the fact that mines have a variable production output resulting in a "half" factory, which can not be built. More info here.

    You do not have to do any math. That's what the script is for. =)
    Build 26 M-Fabs and the script transforms them into 1x 50, 1x 2.
    2 factories instead of 26.
    And they stay modular and upgradable.
    Add another 9 of those M-Fabs and the script would transform the whole thing into 1x 50 and 1x 20.
    2 factories instead of 35.

    If you are using a Module Complex you do not have to position new factories within connection range of the hub any more.
    Randomly drop them somewhere in the sector.
    They are automagically assimilated into the Module Complex when you rerun the crunch command.
    Expanding complexes becomes easier than ever before.

    If your complex contains only completely identical factories then crunch can sometimes compress them into a single module. A single module can no longer be made into a complex...
    That's what Ignore is for. Using that you can exclude a station or module from the crunch command and crunch will only compress the remaining stations/modules.
    As a result you always hava a minimum of 2 modules and can rewire them into a complex.

    Important note regarding Ashley's Factories:
    You must not run the crunch command immediately after building one of Ashley's factories.
    They are not completely constructed at this point. Give it 30-60 seconds to finish it's installation.
    Regular factories are fully constructed right after your TL has built them.
  • hub : A Complex Hub is moved to the position you supply.
    If there is more than one hub in the sector you must target the one you want from your own ship.
    If there is only one hub, the script assumes that you want to move the hub.

    If there is only 1 hub and there also is a Modular Complex in the sector, then special rules apply.
    If you set the position extremely close to the MC then the hub is put in a relatively safe standard position below the MC instead.
    If you set it too far, the hub is placed in the direction you set but still within 19 km of the MC. This way you can still connect more factory modules because the connection range of a complex tube is 20 km.

    north : Complex Hub is rotated so the docking clamps point north (X3 standard)
    south : ...
    east : ...
    west : ...
    up : ...
    down : ...
    If there is more than 1 hub in the sector, the one you want is defined by the position you set.
  • fps : Show current FPS in a message window. A quick way to see how well this works. =)
  • ver or version : Report script version to your logbook.
  • check : CC will verify it's own mod at every version upgrade.
    This command forces the check.
    If you add any other mod (as a fake patch) on top of the CC mod, you can use this command to see if CC is still alive and happy with this installation.
  • ignore : Personally Target one of your stations and run this command on some properly equiped ship. (skip the "Position" argument).
    CC will ignore this station or module on subsequent "crunches".
    Repeat the command for this particular station to remove the ignore flag.

    Regardless of what you had targeted, ignore will always tag all currently ignored stations in sector with a "[ i ]".
    This is purely for your information and can be deleted/renamed at will.
    So if you use ignore without a station targeted, all the script does is check all stations and add the text tag where needed.

    Old Complex Cleaner v1.08 features:
    They still work but don't play in the same league as far as FPS savings go.
    They can run for several minutes on a larger complex.
  • clear : All connected Fabs are moved further out in the sector to a position you supply. If this position is within 100 km of the sector center (or inside a planet...) it is ignored and a safe position is found.
    Note that the player ship must be in the same sector when the command is given but you are free to leave immediately afterwards.
  • restore : All unconnected Fabs are recalled.
    This will be necessary when a hub is destroyed.
    The destination is either a complex hub or if none is supplied, the position.
    Only about 70 Fabs can be recalled at one time because huge safety margins are required to place objects like SPP XL or mines.

Image (ZIP / SPK)
The "script only" version 1.08 is still available as a separate download.

For v3 a mod has to be installed for the new features to work.

Unlike most scripts CC uses a delayed installation.
It will install not on the first but the second time you load a game.
Without that X3 would crash on installation in some cases.

There are 4 versions in the ZIP file:
Cat 30 : Vanilla X3
Cat 31 : Ashley's Factories
Cat 32 : XTM 0.7.2 / 0.7.3
Cat 33 : XTM ? + Ashley's Factories (untested)

The spk version script does not install the mod for you.

This mod does not require you to start a new game.

If you don't run any other mod, simply place all the CAT/DAT files into the MODS folder and activate the right one as "the" mod when you start X3.

If you do select mod package at the X3 launcher window, this mod overrides all fake patches.
Use this feature with caution.

To install them as a "fake patch":
The 2 "right" CAT/DAT files must be placed in your X3 folder and renamed so that their numbers seamlessly follow the existing CAT/DAT files in there and end up as the highest number.

Right: Cat/Dat 10, 11, 12, 13
Wrong: Cat/Dat 10, 11, 12, 30

If you do select mod package at the X3 launcher window, this mod overrides all fake patches.
Use this feature with caution.

CCLeaner will verify the installation on first install and every version upgrade, telling you which CC mod version you installed and if it thinks if that was a good idea.

Removing the pipes
The complete system of pipes is rebuilt every time a new factory is added. After that all pipes remain static.

This means that if you want to get rid of them you
. . . move the hub a good distance away
. . . build and connect a new fab to the complex
. . . . . . (all pipes have been built "far away" now)
. . . move the hub back to where you want it.

The result: The hub is the only thing you see of the whole complex.

Optional is : TCM Tubeless_Complex_Mod. This replaces the 3D model of the tubes with... nothing and I highly recommend it.
This was actually what gave me the idea for this script. Getting rid of the pipes was certainly a good plan but it did nothing about the bulk of the graphics load... which are the factories.

Tech Stuff
Limitations - on the old clear / recall commands:
A maximum of 1000 huge factories (SPP XL, Mines) plus 3000 other Fabs can so be cleared out of your sector.
If a complex hub should be destroyed you can recall a maximum of 72 factories to the sector center (for reconnecting) at one time.

Resources used:
Textfile: 7021
Task ID 7021 on the executing ship
Command slot: COMMAND_TYPE_CUSTOM_24

The only objects created are test dummies with automatic self destruction and there are no permanently running scripts.

If you do not like the text commands, feel free to edit them in t\**7021.xml.

Posted: Fri, 2. Mar 07, 22:54
by Gazz
Version 1.03 released.

Greatly improved performance.
Should be faster especially with large complexes.

The executing ship will show you how much work is left to do.
This can take several minutes with a large complex.

Useful messages for errors or completing the job.

Posted: Sun, 4. Mar 07, 10:17
by Gazz
Version 1.04 released - also available as SPK.

Extensive checks BEFORE placing factories.

They should no longer end up in suns, pools of acid, planets, or Jabba's belly.

Posted: Tue, 6. Mar 07, 21:02
by ohnoes1234
Stupid Question, when you say these commands MUST be entered as text, do you mean we type them in when the script prompts us, or do we have to go through a special step

Posted: Tue, 6. Mar 07, 21:57
by Tracker001
Ruff Translation for The Link TCM Tubless_Complex_Mod >That inspierd Gazz to create the "Complex Cleaner".
Very Nice Mod BTW.

In German:
TCM Tubeless_Complex_Mod Kompatibel mit allen bisherigen Patches Vielen Dank vorab an die zwei fleißigen Tester X-Freak Cartman [KBG] und Victus [KBG], vorallem für die Geduld. Beschreibung: Aufgrund der vielen Probleme, die sich beim Bau von großen Komplexen ergeben können, wurde diese Mod entwickelt. Vor allem Performanceeinbrüche durch die hohe Zahl der Röhren, aber auch einfach nur die meist unschöne Anordnung der Verbindungen vermiesen so einigen den Spielspaß. Durch das Entfernen dieser Röhrenverbindungen kann nun zumindestens etwas Abhilfe geschaffen werden. Die Stationen scheinen nun frei im Raum zu schweben, sind aber weiterhin mit dem Kontrollzentrum verbunden. Es wurde auch darauf geachtet, dass es keine Kollisionsabfrage mehr gibt. Man kann sich frei zwischen den Stationen bewegen und wird an keiner unsichtbaren Verbindung hängen bleiben. Im Spielablauf ansich hat sich aber nichts verändert! Die zu errichtenden Komplexe müssen weiterhin wie bisher aufgestellt werden. Auch die Verwendung von Aufbauhilfen in Form von Scripten wird hiervon nicht beeinträchtigt. Installation: Das Modpaket kann einfach in den Ordner Mods eingefügt werden, oder man benennt die Kataloge um und fügt sie direkt in das X3 Verzeichnis ein Zweitere Variante bietet sich vorallem an, wenn mehrere Mods benutzt werden. Es ist gerade bei diesem Punkt ausgeschlossen, dass es zu Überschneidungen oder Kompatibilitätsproblemen mit anderen Modifikationen kommen kann. Nach Installation und Spielstart werden an allen vorhandenen Komplexen die Röhren entfernt.

In English:
TCM Tubeless_Complex_Mod compatible with all past Patches thank you first to the two industrious testers x-Freak Cartman [ KBG ] and Victus [ KBG ], before all for the patience. Description: Due to the many problems, which can result in the case of the building of large complexes, this Mod was developed. Above all performance break-downs by the high number of the tubes, in addition, simply only the usually unpleasant arrangement of the connections bad unite the play passport in such a way. Now zumindestens something remedy can be created by removing these tube connections. The stations seem to float now freely in the area, are however further connected with the control center. It was also made certain that there is no more collision inquiry. One can move freely between the stations and on no invisible connection hanging will remain. In the expiration of play ansich however nothing changed! Those complexes which can be established must be set up further as before. Also the use of development aids in the form of Scripten is not impaired of it. Installation: The Modpaket can be inserted simply into the file Mods, or one designates the catalogs over and adds her directly into the X3 listing a Zweitere variant offers itself to before all, if several Mods are used. It is impossible straight at this point that it can come to overlaps or compatibility problems with other modifications. According to installation and kind of playing at all existing complexes the tubes are removed.

Posted: Tue, 6. Mar 07, 22:09
by Gazz
ohnoes1234 wrote:when you say these commands MUST be entered as text, do you mean we type them in when the script prompts us

The reason for that is that I would otherwise need one command button for every function of the script.
These are a finite resource meaning there is a limited number available for all scripts to use. Ever.
It is bad style to use more than necessary but alas, not everyone cares. =)

Posted: Wed, 21. Mar 07, 06:59
by DJ Wolf

I have downloaded the zip file. I extract it into the scripts floder or into the X3 main directory? Do I have to select the mod package before I restart X3?

When I'm back in the game do I connect my factories with the complex tubing before or after executing the script?

What exactly would you advise? I understand so little that I don't even know what questions to ask. Knowing what and how to do something is only useful if I need to do it. What do I need to do in order to move 4 disconnected factories out of the way so that they are in a nice close position to be connected into a complex?

Posted: Wed, 21. Mar 07, 10:37
by Gazz
The ZIP file contains everything in the correct folders already.
You unpack the whole thing into the Reunion main folderand it should fall into place.

How to activate the script editor... there's a sticky in this forum for exactly that.

When you do that the script becomes usable with a normal button like all the other commands you give to ships.

Posted: Wed, 21. Mar 07, 18:09
by DJ Wolf
Well that was fun - NOT.

After many hours of trying everything I could think of and resisting the urge to scream here are my results.

I parked my ship in space in the sector concerned and saved the game. I loaded my tractor beam in the nose of the ship. I changed the pilot's name to Thereshallbewings and after a fair bit of searching I found the script editor under personal/Global commands.

Before I went to the script editor, I searched for a new button in my 'ship' commands... nope. Then the other commands... nope. So I went to the script editor. I tried to type in 'Clear', 'Hub', and 'Restore' to make something happen. Nope. This was obviously the wrong place to be. I went through a list of scripts and pluggins and found several with 'Complex cleanup' in the title. But which one should I open? I had a dreadful feeling I was doing the wrong thing. I didn't want to create or edit a script - I just wanted to use one. Am I right?

So, all day I've been trying this and trying that - no button and no place to type anything. So Please, how do I use this script to move 4 stations close together to be ready for joining into a complex?

Posted: Wed, 21. Mar 07, 18:51
by Gazz
I'm not sure what you did but the procedure is
- change pilot name to Thereshallbewings (mind the double L )
- save game
- load game.

THIS activates all user scripts you may have copied into the scripts folder.

You do NOT need to do any typing around in the script editor itself. You ONLY do that when you script things yourself.
Finished scripts like mine install proper buttons for the user to press.

From that point you can go by the explanations in the above posts about the actual script works.

Posted: Thu, 22. Mar 07, 22:11
by Gazz
Version 1.06 released.

Complex Hub can be rotated to the 6 main directions so the docking clamps do not have to point north.

Posted: Sat, 24. Mar 07, 10:54
by Gazz
Version 1.08 released.

Documentation and messages cleaned up.

Destination position for hub or the fab array can be selected.
Having things targeted from the player ship is no longer necessary. This is passed as another argument now.

Note: This does NOT free you from being in the same sector when starting the script.
This script queries the object sizes of the fabs and the fab models (and thus their size) just don't exist OOS.

Posted: Sat, 24. Mar 07, 18:06
by DJ Wolf
It's probably a great script for programmers. I will never know.

There was no button but I was able to find it under ship/orders/custom. I clicked on it and was prompted to type in 'Clear', 'hub' or 'restore'. So I gave 'clear' a go. Well, my fabs disappeared somewhere to a galaxy far far away. I then typed in 'hub' - nothing. I selected the hub in my sector map but I couldn't seem to move it although it was out in space - certainly not to where I tried to move it to. According to the above documentation adding another fab may be the key but I don't want to add another fab. So, I tried 'restore' - nothing. Load saved game again, and again, and again...

After spending two days on it I've decided to load the save I made just before I dropped the stations and just drop them over and over again until I get a decent complex.

What is certainly lacking in this script is documentation which suggests that it was written for other programmers. 'The script has three arguments'? What does that mean in English? I saw no sign of 'command', 'position' or 'complex hub' nor did I get any buttons. I got prompted to type in clear, hub and restore and while 'clear' broke up my complex nothing would fix the piping and restore didn't work.

Posted: Tue, 24. Apr 07, 18:59
by Graxster
Very nice! Easy to use as long as you understand the commands and read the info at the upper-right of the sector map.

With the script editor activated you will find Complex Cleanup in your Commands > Custom. Get in a ship with a tractor beam.

Available commands are:

clear: Moves all your fabs that are part of a complex in this sector out of sight.

restore: Moves all fabs that are not part of a complex to a position 20k above your ship. Useful after self-destructing complex connections, so you can add fabs.

hub: Use to move the current position of your complex hub.

north, south, east, west, up, down: Use to reposition the docking bays of your complex hub to the specified direction.

Example screenshots:

Original complex. Note the position of the docking arms on the hub.

Rotated Hub. After using Commands > Custom and typing in down to change the alignment of the hub's docking arms.

Cleared complex. After typing in clear.

Cleared tubes. After downloading TCM's Tubeless Complex Mod and renaming the files to 11.dat and, placing in the X3 folder to use as a false patch.


Posted: Tue, 24. Apr 07, 19:21
by Gazz
Graxster wrote:Get in a ship with a tractor beam.
I prefer letting another ship (typically my TL) do the job because this can take a while with bigger complexes.
And it's annoying if I disable the AP in my ship with some kind of cursor movement.