[HELP] XML Patch failing for no apparent reasson

The place to discuss scripting and game modifications for X Rebirth.

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

ragamer
Posts: 523
Joined: Wed, 6. Nov 02, 20:31
x4

[HELP] XML Patch failing for no apparent reasson

Post by ragamer »

I'm trying to mimic what the "Configurable Mass Traffic" mod was able to. So far I have managed to manually create the patches needed to reduce all masstraffic but I'm having an issue trying to patch:

md/InitUniverse.xml

This is the patch file:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<diff>
	<replace sel="/mdscript[@name='InitUniverse']/cues/library[@name='InitStationActions']/actions/do_if/add_units[@category='unitcategory.police']/@exact">0.02 * $unitcapacity</replace>
</diff>
(The "replace" tag is single line without \n characters... The split you see is artificially induced by the "code" tag used on this forums)

Basically divides by 10 the number of police drones available for stations at Universe creation (The last functionality added to "Configurable Mass Traffic" mod).

Well... The problem is that XR refuses to load the diff clausule. On the log I get this puzzling error:

Code: Select all

[=ERROR=] Error loading MD file extensions\Configurable_Mass_Traffic\md\InitUniverse.xml: Ignoring root node 'diff' in XML file 'extensions\Configurable_Mass_Traffic\md\InitUniverse.xml'.
WITHOUT any preceeding error related to the same patch file. For example if I put the wrong path on the "sel" clausule I get:

Code: Select all

[=ERROR=] Cannot match path '/mdscript[@name='InitUniverse']/cues/library[@name='InitStationActionsSS']/actions/do_if/add_units[@category='unitcategory.police']/@exact' in patch file 'extensions\Configurable_Mass_Traffic\md\inituniverse.xml'. Skipping node.
Before the former error line so, I'm quite confident the selection clausule is finding the correct node to modify...

...Is this file "special" in the sense on how it treats XPath expressions? I have seen plenty of patches applied to other elements of the mission director directory on other mods and I have created myself a good bunch of patches to aiscripts or...

...I'm missing something basic here?

EDIT: Forgot to mention... This is the ONLY patch applied to the Vanilla file, so a potential collision with another mod acting on the same file is not the answer :(.
User avatar
YorrickVander
Posts: 2774
Joined: Tue, 29. Oct 13, 21:59
x4

Post by YorrickVander »

Code: Select all

[=ERROR=] Error loading MD file extensions\Configurable_Mass_Traffic\md\InitUniverse.xml: Ignoring root node 'diff' in XML file 'extensions\Configurable_Mass_Traffic\md\InitUniverse.xml'. 
This isn't a script failure :) Your mod is fine, this is a common debug line with diff patched files that is generated by the engine ignoring that file at script load *after* patching so diff files are not run as new/replacement files.
X Rebirth - A Sirius Cybernetics Corporation Product

Split irritate visiting pilot with strange vocal patterns.
ragamer
Posts: 523
Joined: Wed, 6. Nov 02, 20:31
x4

Post by ragamer »

This isn't a script failure Smile Your mod is fine, this is a common debug line with diff patched files that is generated by the engine ignoring that file at script load *after* patching so diff files are not run as new/replacement files.
Thanks for the reply... Now that you pointed it, indeed this error happens AFTER I load a savegame, while direct parsing errors are triggered right on starting the game... Sigh, how I miss timestamps on the logfile, would help tons at realizing this time gaps between events.

Return to “X Rebirth - Scripts and Modding”