Any way to update values rather than copy entire XML file?
Moderator: MOD_DW2
-
- Posts: 866
- Joined: Wed Mar 17, 2010 7:53 pm
Any way to update values rather than copy entire XML file?
Is there a way to simply update the values rather than having to copy every XML file and change the values in them?
If I'm mainly changing values here and there it would be way simpler to maintain the mod when they release new content or updates.
I find it quite time consuming to continually update and compare the XML files whenever they release something new.
Anyone that knows anything about this.. I have not found info from the official documentation so I guess it is not possible.
If I'm mainly changing values here and there it would be way simpler to maintain the mod when they release new content or updates.
I find it quite time consuming to continually update and compare the XML files whenever they release something new.
Anyone that knows anything about this.. I have not found info from the official documentation so I guess it is not possible.
Re: Any way to update values rather than copy entire XML file?
Well, if you know a bit about regex-usage and use Notepad++ for this, you could do this (at least a bit quicker) - however you'd need a copy (for backup) and to compare them nevertheless.Jorgen_CAB wrote: Sat Mar 11, 2023 5:26 pm Is there a way to simply update the values rather than having to copy every XML file and change the values in them?
If I'm mainly changing values here and there it would be way simpler to maintain the mod when they release new content or updates.
I find it quite time consuming to continually update and compare the XML files whenever they release something new.
Anyone that knows anything about this.. I have not found info from the official documentation so I guess it is not possible.

(there was a guy (Eventure) who implemented an auto-update function in his mod-maker (with a bit of coding-knowledge), but he's gone now (sadly) - but his work certainly showed that it would be possible.

-
- Posts: 866
- Joined: Wed Mar 17, 2010 7:53 pm
Re: Any way to update values rather than copy entire XML file?
I am using a comparison tool to compare the XML files, otherwise I would go even more crazy... 
I could of course make my own xml update tool and automatically update the XML files, but not sure I have the energy for that at the moment.

I could of course make my own xml update tool and automatically update the XML files, but not sure I have the energy for that at the moment.
Re: Any way to update values rather than copy entire XML file?
Notepad++ has its own compare plugin. Maybe that could help you, if you do not already know that.
besides that, I thing when the Aurora Version came out, there was a PDF that just said something about the modding itself.
There was written, that only those parts, that differ from the original, have to been written in a file and that the original is kept.
What I have understood from that but never checked out is:
If you have in the Data Folder the original file, let say
you have the original
OrbTypes.xml and create an additional
OrbTypesA.xml and write inside that those things, that you want to have changed, then you would have what you want.
I think this works already, because I made chnages to the
orbtypes.xml and changed the name of the original to
OrbtypesOrig.xml
Guess what, somehow my changes were not working
Sorry that I can not show you the page where this is talked abouit, but I think it is the thread, where the Aurora update or the 1.0.9.0 Patch is talked about.. The first thread where modding was official implemented.
besides that, I thing when the Aurora Version came out, there was a PDF that just said something about the modding itself.
There was written, that only those parts, that differ from the original, have to been written in a file and that the original is kept.
What I have understood from that but never checked out is:
If you have in the Data Folder the original file, let say
you have the original
OrbTypes.xml and create an additional
OrbTypesA.xml and write inside that those things, that you want to have changed, then you would have what you want.
I think this works already, because I made chnages to the
orbtypes.xml and changed the name of the original to
OrbtypesOrig.xml
Guess what, somehow my changes were not working

Sorry that I can not show you the page where this is talked abouit, but I think it is the thread, where the Aurora update or the 1.0.9.0 Patch is talked about.. The first thread where modding was official implemented.
-
- Posts: 866
- Joined: Wed Mar 17, 2010 7:53 pm
Re: Any way to update values rather than copy entire XML file?
Notepad++ is one of the tools I use to compare files, so yes I know about that. I will have to look up that other thing you mention and see how that is suppose to work.
-
- Posts: 866
- Joined: Wed Mar 17, 2010 7:53 pm
Re: Any way to update values rather than copy entire XML file?
rxnnxs wrote: Sat Mar 11, 2023 6:57 pm What I have understood from that but never checked out is:
If you have in the Data Folder the original file, let say
you have the original
OrbTypes.xml and create an additional
OrbTypesA.xml and write inside that those things, that you want to have changed, then you would have what you want.
I think this works already, because I made chnages to the
orbtypes.xml and changed the name of the original to
OrbtypesOrig.xml
Yes that works well, not entirely what I want as I still have to add the entire section and not just the single key I want updated.
If I just add a file like...
PlanetaryFacilityDefinitions_MyMod.xml
...to my mod folder.
I can just add the sections I want to change based on the ID tag. It simply overwrite that from the original file.
It would have been even better if we could just have defined the ID and the particular tag you wanted to update because then I would also be protected from if they add any additional keys in the future and I also would get way less text in the modding files.
But this works decently good for now...
Re: Any way to update values rather than copy entire XML file?
I think this is not working because you didn't use the right syntax (in the filename) - you're missing a "_".rxnnxs wrote: Sat Mar 11, 2023 6:57 pm There was written, that only those parts, that differ from the original, have to been written in a file and that the original is kept.
If you have in the Data Folder the original file, let say
you have the original
OrbTypes.xml and create an additional
OrbTypesA.xml and write inside that those things, that you want to have changed, then you would have what you want.
(...)
Guess what, somehow my changes were not working![]()
So your file would need to be named "OrbTypes_A.xml" - then it should work.

Just look in the data folder - there are several files that are already named like this - and the session-log lists them as "override".

Re: Any way to update values rather than copy entire XML file?
@Jorgen_CAB good that it works. Better than the whole file.
@ frankycl well, you are right of course. And I use to name it XX_orig when I make a backup
@ frankycl well, you are right of course. And I use to name it XX_orig when I make a backup

Re: Any way to update values rather than copy entire XML file?
Wasn't that half the modding changes in Aurora?Jorgen_CAB wrote: Sat Mar 11, 2023 5:26 pm Is there a way to simply update the values rather than having to copy every XML file and change the values in them?
If I'm mainly changing values here and there it would be way simpler to maintain the mod when they release new content or updates.
I find it quite time consuming to continually update and compare the XML files whenever they release something new.
Anyone that knows anything about this.. I have not found info from the official documentation so I guess it is not possible.
https://www.matrixgames.com/amazon/Uplo ... geList.pdfDW2 Modding currently supports the following modded items:
1. XML data files
- Mods should add their own versions of these files by appending a suffix to the filename,
e.g. Races_MYMOD.xml. The file will then be loaded after the base Races.xml file, adding
any new entries and overriding any existing entries that use the same RaceId value
-- All of the XML data files use this same file-naming and item-overriding approach. So you
can change data in the base XML data files by using the same Id value in a modded file, e.g.
OrbTypeId for OrbTypes.xml, ResearchProjectId for ResearchProjectDefinitions.xml, etc.
So you would only have to provide a file with the few overridden items.
-
- Posts: 866
- Joined: Wed Mar 17, 2010 7:53 pm
Re: Any way to update values rather than copy entire XML file?
You are a bit late as we already figured that one out... I only wished we could update specific values not whole sections to make the mods even more future proof.zgrssd wrote: Sun Mar 12, 2023 10:22 amWasn't that half the modding changes in Aurora?Jorgen_CAB wrote: Sat Mar 11, 2023 5:26 pm Is there a way to simply update the values rather than having to copy every XML file and change the values in them?
If I'm mainly changing values here and there it would be way simpler to maintain the mod when they release new content or updates.
I find it quite time consuming to continually update and compare the XML files whenever they release something new.
Anyone that knows anything about this.. I have not found info from the official documentation so I guess it is not possible.
https://www.matrixgames.com/amazon/Uplo ... geList.pdfDW2 Modding currently supports the following modded items:
1. XML data files
- Mods should add their own versions of these files by appending a suffix to the filename,
e.g. Races_MYMOD.xml. The file will then be loaded after the base Races.xml file, adding
any new entries and overriding any existing entries that use the same RaceId value
-- All of the XML data files use this same file-naming and item-overriding approach. So you
can change data in the base XML data files by using the same Id value in a modded file, e.g.
OrbTypeId for OrbTypes.xml, ResearchProjectId for ResearchProjectDefinitions.xml, etc.
So you would only have to provide a file with the few overridden items.
Say I want to reduce the maintenance of all ground troops... I essentially might just overwrite the whole file and just do a comparison. What I would liked to do is just specify each id and update the "maintenance" key value.
Re: Any way to update values rather than copy entire XML file?
Well, if the maintenance-cost should be every where the same, it's very easy to do this:Jorgen_CAB wrote: Sun Mar 12, 2023 10:46 amYou are a bit late as we already figured that one out... I only wished we could update specific values not whole sections to make the mods even more future proof.zgrssd wrote: Sun Mar 12, 2023 10:22 amWasn't that half the modding changes in Aurora?Jorgen_CAB wrote: Sat Mar 11, 2023 5:26 pm Is there a way to simply update the values rather than having to copy every XML file and change the values in them?
If I'm mainly changing values here and there it would be way simpler to maintain the mod when they release new content or updates.
I find it quite time consuming to continually update and compare the XML files whenever they release something new.
Anyone that knows anything about this.. I have not found info from the official documentation so I guess it is not possible.
https://www.matrixgames.com/amazon/Uplo ... geList.pdfDW2 Modding currently supports the following modded items:
1. XML data files
- Mods should add their own versions of these files by appending a suffix to the filename,
e.g. Races_MYMOD.xml. The file will then be loaded after the base Races.xml file, adding
any new entries and overriding any existing entries that use the same RaceId value
-- All of the XML data files use this same file-naming and item-overriding approach. So you
can change data in the base XML data files by using the same Id value in a modded file, e.g.
OrbTypeId for OrbTypes.xml, ResearchProjectId for ResearchProjectDefinitions.xml, etc.
So you would only have to provide a file with the few overridden items.
Say I want to reduce the maintenance of all ground troops... I essentially might just overwrite the whole file and just do a comparison. What I would liked to do is just specify each id and update the "maintenance" key value.
Just search for the first maintenance-entry, use search+replace - and then "replace all".

Re: Any way to update values rather than copy entire XML file?
+1Jorgen_CAB wrote: Sun Mar 12, 2023 10:46 am
You are a bit late as we already figured that one out... I only wished we could update specific values not whole sections to make the mods even more future proof.
Say I want to reduce the maintenance of all ground troops... I essentially might just overwrite the whole file and just do a comparison. What I would liked to do is just specify each id and update the "maintenance" key value.
-
- Posts: 866
- Joined: Wed Mar 17, 2010 7:53 pm
Re: Any way to update values rather than copy entire XML file?
Sure... but it is not and that would not solve 95% of the other cases either. This was just one example out of many.frankycl wrote: Sun Mar 12, 2023 12:04 pm
Well, if the maintenance-cost should be every where the same, it's very easy to do this:
Just search for the first maintenance-entry, use search+replace - and then "replace all".(you even don't need any regex for this)