Parsing save game - station names

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

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

foxxbl
Posts: 385
Joined: Sat, 8. May 10, 10:31
x4

Parsing save game - station names

Post by foxxbl »

Hi!
I am working on a utility to parse stations from the save game.
Now one thing is really bugging me - how station names are stored and shown in the game?
For example, one random Teladi Scanning Array Factory has the following definition in the save game:

Code: Select all

<component class="station" macro="station_gen_factory_base_01_macro" connection="space" attackmethod="lowattentionattack" attacktime="395276.745" shipattacktime="395276.745" intentionalattacktime="395276.745" code="FXN-270" owner="teladi" knownto="player" level="0.2" transportdronemode="trade" pendingtransportdronemode="trade" usertransportdronemode="trade" spawntime="35120.522" id="[0x4b6da]">
Nothing which will tell directly what is the station's name except by examining wares.. I suspect there must be some easier way..
About half stations have source entry which can be used to decode the stations name, but it's not consistent for all stations.
For example this TEL Engine Part Factory has a source entry which can used to decode the station's name:

Code: Select all

<component class="station" macro="station_gen_factory_base_01_macro" connection="space" attackmethod="lowattentionattack" attacktime="374709.775" shipattacktime="374709.775" intentionalattacktime="374709.775" code="ZFP-681" owner="teladi" knownto="player" level="0.2" transportdronemode="trade" pendingtransportdronemode="trade" usertransportdronemode="trade" spawntime="0" id="[0x4b7a6]">
..
<source entry="tel_engineparts" seed="1565741328226223163" class="godproduction"/>
Thanks for any tips!
Cheers!
Defending Split brothers from Xenon since 2020.

X4:Foundations:
* Abandoned/Derelict ships and locations
* X4 Black Marketeer Finder
User avatar
YorrickVander
Posts: 2774
Joined: Tue, 29. Oct 13, 21:59
x4

Re: Parsing save game - station names

Post by YorrickVander »

I think for npc stations you would need to be very generic, or work out the ruleset ego use for the auto name. If you look at a player station, my HQ in this example, it has a name="" field

Code: Select all

<component class="station" macro="station_pla_headquarters_base_01_macro" connection="space" attacker="[0xc1fabb6]" attackmethod="lowattentionattack" attacktime="1830798.922" attackership="[0xc1fabb6]" shipattacktime="1830798.922" intentionalattacktime="1830798.922" name="The Ta Foundation" code="XPP-525" owner="player" knownto="player" basename="Segaris Start" variation="0" transportdronemode="trade" pendingtransportdronemode="trade" usertransportdronemode="trade" transportdronesblocked="1" spawntime="0" overviewgraphs="medicalsupplies terranmre" id="[0x813bd28]">
for the name I gave it. However, you can search the map in game for the unique reg

Code: Select all

code="XPP-525"
as a workaround, and just give the station a "sector faction factory/defence/trade" kind of name in your output to go with it. Better modders might have a better way, but it would get you started.
X Rebirth - A Sirius Cybernetics Corporation Product

Split irritate visiting pilot with strange vocal patterns.

Return to “X4: Foundations - Scripts and Modding”