[TOOL] X4 Customizer 1.23

The place to discuss scripting and game modifications for X4: Foundations.

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

SirNukes
Posts: 546
Joined: Sat, 31. Mar 07, 23:44
x4

Re: [TOOL] X4 Customizer 1.7.1

Post by SirNukes » Mon, 14. Jan 19, 08:43

Updated to 1.8

This update adds an Extensions tab to the GUI. From here, you may view, enable, disable, and test extensions. Tests will load all files from an extension to look for errors or conflicts with other extensions (same as the prior Check_Extensions command line tool, but refined). The GUI will show any seeming errors found. This should be much faster than loading x4, much easier than reading the x4 log, and can catch some errors the x4 log is silent about (like duplicate extension IDs).

For this release, I downloaded the top 100 mods off of Nexus (plus FOCW and a couple others) to stress test the code, hopefully weeding out most of the major bugs when loading oddly formed input files.

I also added a Color_Text transform, which can apply a color code to selected text entries across all languages. It was mostly added for some quick fun, but might be useful later in building a more complex transform, like coloring npc names based on their race.

XavierX wrote:
Sun, 13. Jan 19, 22:43
Is It possible to create missions with this framework?
No, that is outside the current scope of this tool, which is mostly aimed at adjusting existing content rather than creating new content.

Nebulaewolf
Posts: 15
Joined: Thu, 3. Mar 11, 12:19
x3

Re: [TOOL] X4 Customizer 1.9

Post by Nebulaewolf » Thu, 31. Jan 19, 07:40

G'day SirNukes, many thanks, this is a great tool :thumb_up: . Not being overly familiar with python I am using the GUI version.
I don't want to appear a complete noob, but I can't workout how to get the analysis scripts to output anything. I want to output the vanilla statistics, to a csv output so that I have a baseline, but can't figure out how to do it in the GUI??? :gruebel:
A little guidance would be greatly appreciated.
Cheers
We have learned from our mistakes, and can now repeat them almost perfectly.

SirNukes
Posts: 546
Joined: Sat, 31. Mar 07, 23:44
x4

Re: [TOOL] X4 Customizer 1.9

Post by SirNukes » Thu, 31. Jan 19, 20:27

On the Config tab, set up the paths to the X4 installation and the user folder (where saves, content.xml, and such as located). Optionally change the name of the output extension; its folder is where the csv files will be written. On the script tab, start a new script and type or drag Print_Weapon_Stats() and/or Print_Ware_Stats() at the end (optionally deleting Apply_Live_Editor_Patches and Write_To_Extension). Then press Run Script near the top of the gui. If all goes well, csv and html files can be found in the output extension folder (along with a couple other log files).

Side note: csv format is a little ugly currently. Html is somewhat better. You can also view this data in the gui itself using the Edit tabs.

Nebulaewolf
Posts: 15
Joined: Thu, 3. Mar 11, 12:19
x3

Re: [TOOL] X4 Customizer 1.9

Post by Nebulaewolf » Thu, 31. Jan 19, 20:53

G'day SirNukes, many thanks found it in steam/extensions. I initially ran the script with it set to write to user/extensions and got following error meassage: PermissionError: "[Errno 13] Permission denied: 'W:\\Grant Documents\\Egosoft\\X4\\60023335\\extensions\\x4_customizer_output\\weapon_stats.csv'". When I changed the setting to write to the default output, it wrote to steam/extensions.

Ok I am a complete noob :( I'm still having an issue with getting stats for Ships and components, I entered Ships and Ship_stats as arguments for Print_Objects_Stats and I get an error message "Ship_stats" not defined

Would there be any chance of building in an export command/button to the GUI, so that one could export the various tabs to csv/html as one went along? To either get baseline or diff/updated statistics onto a spread sheet as you went along?
Last edited by Nebulaewolf on Thu, 31. Jan 19, 22:25, edited 1 time in total.
We have learned from our mistakes, and can now repeat them almost perfectly.

SirNukes
Posts: 546
Joined: Sat, 31. Mar 07, 23:44
x4

Re: [TOOL] X4 Customizer 1.9

Post by SirNukes » Thu, 31. Jan 19, 21:45

Nebulaewolf wrote:
Thu, 31. Jan 19, 20:53
Ok I am a complete noob :( I'm still having an issue with getting stats for Ships and components, I entered Ships and Ship_stats as arguments for Print_Objects_Stats and I get an error message "Ship_stats" not defined
I don't have full documentation on all of the Print_Objects_Stats possible inputs currently in there, though they generally match the names of the Edit tabs but lowercased ("weapons", "bullets", "ships", etc.).

Nebulaewolf
Posts: 15
Joined: Thu, 3. Mar 11, 12:19
x3

Re: [TOOL] X4 Customizer 1.9

Post by Nebulaewolf » Thu, 31. Jan 19, 22:28

G'day SirNukes, I am usually only a humble texture/model modder and know very little about scripts or why they don't work when they don't work, but would there be any chance of building in an export command/button to the GUI, so that one could export the various tabs to csv/html as one went along? To either get baseline or diff/updated statistics onto a spread sheet as you went along?

Input:
# X4 Customizer input script.
from Plugins import *

# Write modified files to the output extension.
Write_To_Extension()

Print_Object_Stats(
Ships,
Ship_Stats,
None)

Output:
New script started
Saved script to "D:\Grant Downloads\Game Downloads\X4\Moddinig\Tools\X4 Customiser Tool\X4_Customizer_v1.9\Scripts\Ships_Print.py"
Saved Live Editor patches
Starting thread: Run(D:\Grant Downloads\Game Downloads\X4\Moddinig\Tools\X4 Customiser Tool\X4_Customizer_v1.9\Scripts\Ships_Print.py -argpass)
Calling D:\Grant Downloads\Game Downloads\X4\Moddinig\Tools\X4 Customiser Tool\X4_Customizer_v1.9\Scripts\Ships_Print.py
Cleaning up old files
Writing output files (diff encoded)
Successfully ran Write_To_Extension
Exception of type "NameError" encountered.

name 'Ship_Stats' is not defined
Script run completed

I've tried upper and lower case (Uppercase matches category) but file_name i can't get to work with either lower/uppercase, version not sure?
Print_Object_Stats(
category,
file_name,
version = None,
We have learned from our mistakes, and can now repeat them almost perfectly.

SirNukes
Posts: 546
Joined: Sat, 31. Mar 07, 23:44
x4

Re: [TOOL] X4 Customizer 1.9

Post by SirNukes » Fri, 1. Feb 19, 02:23

Nebulaewolf wrote:
Thu, 31. Jan 19, 22:28
would there be any chance of building in an export command/button to the GUI, so that one could export the various tabs to csv/html as one went along? To either get baseline or diff/updated statistics onto a spread sheet as you went along?
I put it on my todo list.

This function requires python string arguments, so an example might look like:

Code: Select all

from Plugins import *
Print_Object_Stats('ships', 'ship_stats')

Nebulaewolf
Posts: 15
Joined: Thu, 3. Mar 11, 12:19
x3

Re: [TOOL] X4 Customizer 1.9

Post by Nebulaewolf » Fri, 1. Feb 19, 06:13

G'day SirNukes, thank you again, the 'apostrophes' d'oh. Worked and I learnt something :)

One minor thing with the csv output, I think that because the data in the name, description etc fields in the xml are in the format {xxxxx, yyyyyy}; the output gets split over the T Name Entry and T Desc. Entry data fields in the output csv. I think it might be because the output is reading the comma as a separation: (please see example below)

Name---------------------------------T Name Entry---T Desc. Entry--- Codename--------Class
M Dumbfire Launcher Mk1 ----------{20105-------------2124}-----------{20105----------2122}
sorry about the dashes but it was the quickest way to tab out the info so that you could see where it is going


This not the same in the html output where it gets tabulated correctly:

Name--------------------------T Name Entry---T Desc. Entry-------------------------Codename------------------------Class
S Dumbfire Launcher Mk1--{20105,1124}----{20105,1122}---weapon_gen_s_dumbfire_01_mk1_macro---missilelauncher

This is a really great tool, I am still sorting out the spread sheets, but am looking forwarded to using your tool for some re-balancing and overhaul modding :)
We have learned from our mistakes, and can now repeat them almost perfectly.

Whatever0815
Posts: 45
Joined: Wed, 6. Mar 19, 06:02
x4

Re: [TOOL] X4 Customizer 1.9

Post by Whatever0815 » Sun, 10. Mar 19, 14:55

SirNukes,

just want to give you a pretty big Kudo for creating and sharing your X4 Customizer.

I've never used any mods for X4 before, let alone created one. In fact, the first time I ever saw the data structures was in your Customizer.

Pure gold being able to explore these structures, hack away at them using Python and your swiss army knife pms, then have the Customizer take care of the details of turning the results into a working mod.

Much appreciated :)

bobchocolat@gmx.fr
Posts: 5
Joined: Wed, 13. Mar 19, 11:37

Re: [TOOL] X4 Customizer 1.9

Post by bobchocolat@gmx.fr » Fri, 15. Mar 19, 09:35

Thanks you for your excellent ... thing ;)
I'm noob in python but I'm starting to understand how it works ...
On the other hand, the Cat_Pack does not pack the folder "index" that contain macro.xml with all mods ... I put the extensions folder that I previously Unpack (with you Cat_Unpack.bat) in the Cat_Pack.bat and it packs everything except the index folder and it does not indicate any error, just the number of less files that I had with the Unpack...
MapMarker is an exemple:
https://www.nexusmods.com/x4foundations ... ?tab=files
I imagine, perhaps wrongly, that there must be another script with the list of folders to pack ... that I can not find ...
If not, how to do it then ...
Sorry for googleTrad ;)
@+

SirNukes
Posts: 546
Joined: Sat, 31. Mar 07, 23:44
x4

Re: [TOOL] X4 Customizer 1.9

Post by SirNukes » Fri, 15. Mar 19, 20:42

1.9.1 is uploaded with fixes for the csv commas and the missed index folder. It should also detect script changes from outside the gui environment, if you prefer to edit scripts elsewhere.

I've actually been sitting on the "index" fix for a while, but have been neglecting to update this tool, for which I apologize. A couple months ago, I ported the gui framework from the Customizer over to my tool flow at work (where I have designed a couple many-core chips along with support tools for app development, compilation, simulation, chip testing, etc.). The drawback there is that the gui brought in more users to support, leaving less time available for X4 modding.

bobchocolat@gmx.fr
Posts: 5
Joined: Wed, 13. Mar 19, 11:37

Re: [TOOL] X4 Customizer 1.9.1

Post by bobchocolat@gmx.fr » Fri, 15. Mar 19, 22:55

Thank you Bro,
If someone has to apologize here, it's me who is not able to understand alone;)
Otherwise, I do not remember which mod I did not arrive at Unpack, it seems to me that it contained .sig, I will look later ...
Thanks again for the fix ...

SirNukes
Posts: 546
Joined: Sat, 31. Mar 07, 23:44
x4

Re: [TOOL] X4 Customizer 1.9.1

Post by SirNukes » Sat, 16. Mar 19, 02:19

The code currently skips sig files, to avoid cluttering up the files being tracked and on the assumption no one would ever need them. Though it sounds like some mods are using them, so I can look into adding support for them (perhaps only when packing catalogs).

SirNukes
Posts: 546
Joined: Sat, 31. Mar 07, 23:44
x4

Re: [TOOL] X4 Customizer 1.15.2

Post by SirNukes » Sat, 18. Apr 20, 03:31

Updated to 1.15.2. Lots of changes since the last post to this thread, but the more recent ones:

Scale_Sector_Size transform will dynamically rescale sectors, adjusting positions of zones, highways, god-placed objects, and the player hq. Highways remain functional.

Generate_Diffs is a new utility which can automatically create diff patch files by comparing a pair of input files, an original and a modded version. This works on individual files, or recursively over a directory.

Ferîx
Posts: 94
Joined: Thu, 12. Apr 12, 08:35
xr

Re: [TOOL] X4 Customizer 1.15.2

Post by Ferîx » Tue, 21. Apr 20, 10:26

SirNukes wrote:
Sat, 18. Apr 20, 03:31
Updated to 1.15.2. Lots of changes since the last post to this thread, but the more recent ones:
Thank you A LOT for this tool, really the one I've been missing all this time. Just began to explore the possibilities and I must say this thing is DEEP

edit:
I got something that looks like a bug: when I try to use print_weapon_stats plugin through the GUI I get this

Code: Select all

Could not print objects, error obtaining tree view for category "weapons".
but at the same time, when I fire the print_ware_stats it works fine and prints all I want.
The thing is, I managed to get the weapons print once, but deleted the files (as I didn't need them at the moment). Since then I get this error.

Win 10 up to date, x4 3.10 HF1 + split dlc, no modified game files (except extensions folder with mods, ofc)

edit2: the above seems to be resolved through deleting the extracted X4_Customizer_v1.15.3 folder completely except settings.json, restoring it from .zip and putting the settings.json back.

SirNukes
Posts: 546
Joined: Sat, 31. Mar 07, 23:44
x4

Re: [TOOL] X4 Customizer 1.15.2

Post by SirNukes » Tue, 21. Apr 20, 19:02

Ferîx wrote:
Tue, 21. Apr 20, 10:26
edit2: the above seems to be resolved through deleting the extracted X4_Customizer_v1.15.3 folder completely except settings.json, restoring it from .zip and putting the settings.json back.
If it happens again I can try looking into it. Also, there is a developer mode flag in the settings which will trigger a printout with more information on errors, such as a stack trace, which could help me track down an issue.

Ferîx
Posts: 94
Joined: Thu, 12. Apr 12, 08:35
xr

Re: [TOOL] X4 Customizer 1.15.2

Post by Ferîx » Wed, 22. Apr 20, 08:29

SirNukes wrote:
Tue, 21. Apr 20, 19:02
If it happens again I can try looking into it. Also, there is a developer mode flag in the settings which will trigger a printout with more information on errors, such as a stack trace, which could help me track down an issue.
I'll upload the folder if this happens again, everything works fine so far tho. Thanks again for the awesome tool!

Ferîx
Posts: 94
Joined: Thu, 12. Apr 12, 08:35
xr

Re: [TOOL] X4 Customizer 1.15.2

Post by Ferîx » Thu, 23. Apr 20, 07:37

Is it possible to add custom transforms to the list in the left window of the Script tab in GUI? I tried to modify Ships.py to only alter mass and inertia and save it as a separate script, but couldn't figure out how to make it work alongside with the original. I found some info on this in 'plugins/__init__' but messing with import here leads to errors starting the tool.

SirNukes
Posts: 546
Joined: Sat, 31. Mar 07, 23:44
x4

Re: [TOOL] X4 Customizer 1.15.2

Post by SirNukes » Thu, 23. Apr 20, 19:41

Ferîx wrote:
Thu, 23. Apr 20, 07:37
Is it possible to add custom transforms to the list in the left window of the Script tab in GUI? I tried to modify Ships.py to only alter mass and inertia and save it as a separate script, but couldn't figure out how to make it work alongside with the original. I found some info on this in 'plugins/__init__' but messing with import here leads to errors starting the tool.
Hm. As far as this goes, it's just a matter of navigating the python package import system. Adding a file to the Transforms plugin folder, and importing the function into the Transforms __init__, should be sufficient. Though it isn't ideal for extensibility, since __init__ would need another edit (or merge if going through git directly) each time the tool is swapped to a new version.

It's probably worth noting that anything done by a plugin transform can be done directly from a user script, maybe with some tweaks to the import paths, except for the gui window update.

Ferîx
Posts: 94
Joined: Thu, 12. Apr 12, 08:35
xr

Re: [TOOL] X4 Customizer 1.15.2

Post by Ferîx » Fri, 24. Apr 20, 13:18

SirNukes wrote:
Thu, 23. Apr 20, 19:41

it's just a matter of navigating the python package import system. Adding a file to the Transforms plugin folder, and importing the function into the Transforms __init__, should be sufficient.
Yeah, in fact it's just my very limited understanding of scripting prevented me from doing this successfully, though I get the basic flow here. Gonna mess with this more during the weekend and will post here in case of any luck. And before that, I'll stick to this method, 'cause I already got it working :arrow:
It's probably worth noting that anything done by a plugin transform can be done directly from a user script, maybe with some tweaks to the import paths, except for the gui window update.

Post Reply

Return to “X4: Foundations - Scripts and Modding”