Page 1 of 1

Any way to update values rather than copy entire XML file?

Posted: Sat Mar 11, 2023 5:26 pm
by Jorgen_CAB
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.

Re: Any way to update values rather than copy entire XML file?

Posted: Sat Mar 11, 2023 5:55 pm
by frankycl
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.
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. ;)
(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. :) )

Re: Any way to update values rather than copy entire XML file?

Posted: Sat Mar 11, 2023 6:37 pm
by Jorgen_CAB
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.

Re: Any way to update values rather than copy entire XML file?

Posted: Sat Mar 11, 2023 6:57 pm
by rxnnxs
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.

Re: Any way to update values rather than copy entire XML file?

Posted: Sat Mar 11, 2023 7:04 pm
by Jorgen_CAB
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.

Re: Any way to update values rather than copy entire XML file?

Posted: Sat Mar 11, 2023 7:41 pm
by Jorgen_CAB
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?

Posted: Sat Mar 11, 2023 7:47 pm
by frankycl
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 :-)
I think this is not working because you didn't use the right syntax (in the filename) - you're missing a "_".

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?

Posted: Sat Mar 11, 2023 8:35 pm
by rxnnxs
@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 :-)

Re: Any way to update values rather than copy entire XML file?

Posted: Sun Mar 12, 2023 10:22 am
by zgrssd
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.
Wasn't that half the modding changes in Aurora?
DW2 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.
https://www.matrixgames.com/amazon/Uplo ... geList.pdf

So you would only have to provide a file with the few overridden items.

Re: Any way to update values rather than copy entire XML file?

Posted: Sun Mar 12, 2023 10:46 am
by Jorgen_CAB
zgrssd wrote: Sun Mar 12, 2023 10:22 am
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.
Wasn't that half the modding changes in Aurora?
DW2 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.
https://www.matrixgames.com/amazon/Uplo ... geList.pdf

So you would only have to provide a file with the few overridden items.
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.

Re: Any way to update values rather than copy entire XML file?

Posted: Sun Mar 12, 2023 12:04 pm
by frankycl
Jorgen_CAB wrote: Sun Mar 12, 2023 10:46 am
zgrssd wrote: Sun Mar 12, 2023 10:22 am
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.
Wasn't that half the modding changes in Aurora?
DW2 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.
https://www.matrixgames.com/amazon/Uplo ... geList.pdf

So you would only have to provide a file with the few overridden items.
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.
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)

Re: Any way to update values rather than copy entire XML file?

Posted: Sun Mar 12, 2023 12:08 pm
by AKicebear
Jorgen_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.
+1

Re: Any way to update values rather than copy entire XML file?

Posted: Sun Mar 12, 2023 12:23 pm
by Jorgen_CAB
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)
Sure... but it is not and that would not solve 95% of the other cases either. This was just one example out of many.