[help] <diff> doesnt work !

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

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

Eagle_Four
Posts: 231
Joined: Wed, 6. Nov 02, 20:31
x3

[help] <diff> doesnt work !

Post by Eagle_Four » Fri, 21. Jul 23, 16:21

I've been trying to patch a simple MD mod with <diff> all day.

It just does not work. I have tried it with replace and add.
I have also read the whole XRebirth thread about patching.

This is a small test mod:

Code: Select all

<?xml version="1.0" encoding="utf-8" ?>
<mdscript name="ZweiterMod" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="md.xsd">
	<cues>
		<cue name="Text_Window" checkinterval="5s" instantiate="false">
			<delay min="10s" max="10s"/>
        	<actions>

<!-- 		<set_value name="$Text" exact="' This text should appear'" />
 		<show_help custom="$Text" position="1" duration="3s" allowclose="true" chance="100"/>
 -->
			<reset_cue cue="this"/>
		</actions>
		</cue>
	</cues>
</mdscript>
and this is the patch mod:

Code: Select all

<?xml version="1.0" encoding="utf-8" ?>

<diff xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<add sel="/cues/cue[@name='Text_Window']/actions" pos="prepend">
 
		<set_value name="$Text" exact="'Overwritten Text'" />
 		<show_help custom="$Text" position="1" duration="3s" allowclose="true" chance="100"/>
	 </add>
</diff>

There should be a text every 10 sec. Without patch the mod works. I have already tried umpteen path combinations. I am running out of ideas. What have I overlooked?

Eagle_Four
Posts: 231
Joined: Wed, 6. Nov 02, 20:31
x3

Re: [help] <diff> doesnt work !

Post by Eagle_Four » Fri, 21. Jul 23, 18:22

I think I figured out why it doesn't work. I tried to patch a custom mod that is in /expansion. As it looks <diff> works only with core files. I moved the mod to /MD as a test and it works there.

But now I have the question, it does not work with custom mods that are located in /expansion or I have not specified the correct path?

User avatar
Dj_FRedy
Posts: 237
Joined: Mon, 27. Jun 11, 05:58
x4

Re: [help] <diff> doesnt work !

Post by Dj_FRedy » Fri, 21. Jul 23, 20:14

Look at the folder structure.
Patch a file:

Code: Select all

X4 Foundations\extensions\my_mod\md\name_file_to_patch.xml
Patch a DLC file:

Code: Select all

X4 Foundations\extensions\my_mod\extensions\ego_dlc_boron\md\name_file_to_patch.xml
Patch a MOD file:

Code: Select all

X4 Foundations\extensions\my_mod\extensions\name_mod_to_patch\md\name_file_to_patch.xml
EDIT:
Diff like this:

Code: Select all

<?xml version="1.0" encoding="utf-8" ?>
<diff>
    <add sel="mdscript/cues/cue[@name='Text_Window']/actions/reset_cue" pos="before">
        <set_value name="$Text" exact="'Overwritten Text'" />
        <show_help custom="$Text" position="1" duration="3s" allowclose="true" chance="100"/>
     </add>
</diff>
"All my contributions to the Technical Support and Public Beta Feedback sections will be concise and to the point, no diatribes, that's what the other sections are for".
Thank you for your efforts.

Eagle_Four
Posts: 231
Joined: Wed, 6. Nov 02, 20:31
x3

Re: [help] <diff> doesnt work !

Post by Eagle_Four » Sat, 22. Jul 23, 07:01

Thank you very much. You have to come up with it first. What should I do without you ;-)

However, this does not work(No matching node for path):

Code: Select all

    <add sel="mdscript/cues/cue[@name='Text_Window']/actions/reset_cue" pos="before">

This, on the other hand, does:

Code: Select all

    <add sel="//cues/cue[@name='Text_Window']/actions/reset_cue" pos="before">
Just in case anyone wants to test this on themselves.

User avatar
Dj_FRedy
Posts: 237
Joined: Mon, 27. Jun 11, 05:58
x4

Re: [help] <diff> doesnt work !

Post by Dj_FRedy » Sat, 22. Jul 23, 10:57

Yeah, a forward slash (/mdscript) is to blame:

Code: Select all

<add sel="/mdscript/cues/cue[@name='Text_Window']/actions/reset_cue" pos="before">
Another point to keep in mind regarding patching mods/extensions files has to do with the order in which the files are loaded. Always make sure that extensions are loaded before patches or diffs. To make sure of this we put in the 'content.xml' file of our patch:

Code: Select all

<!-- optional="true": No error if dependency missing/disabled. This is only used to define the loading order of extensions (dependencies are loaded first). -->
<dependency id="name_mod_to_patch" version="100" optional="false" name="name mod to patch"/>
So many little details ... and thank you for your kind words :wink:
"All my contributions to the Technical Support and Public Beta Feedback sections will be concise and to the point, no diatribes, that's what the other sections are for".
Thank you for your efforts.

morning_star
Posts: 9
Joined: Tue, 30. May 23, 03:46
x4

[help plz] <diff> doesn't change a thing

Post by morning_star » Sun, 10. Sep 23, 14:43

Hello!

I am working on a simple rebalance mod that adds a second shield to each s-fighter and changes some stats. (inspired by RoverTX`s improved buzzard)

It worked smoothly for the Split ships, PAR ships and most Argon fighters, but for some reason I cannot get the Pulsar to work.

my mod file is called "ship_arg_s_fighter_03.xml" and thats the code I used:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<diff>
	<add sel="//components/component/connections">
		<connection name="con_shield_02" tags="small shield standard unhittable ">
			<offset>
				<position x="0" y="2.565639" z="-4.839263"/>
			</offset>
		</connection>
	</add>
</diff>
this approach worked for every other fighter I tried until now but for some reason won't work with the Pulsar.
The file just sits right there in the folder between all the others which are doing their job just fine.

I had a similar issue when changing the cargo values of the new 6.0 building ships (thru their respective macro files) ... everything worked fine with the same approach
- except for the boron builder.

I double- and triple-checked for typos, duplicate connection names, syntax errors, directory structure mishaps whatsoever - but nothing :(

Any help and guidance is greatly appreciated!!
Thanks!

Return to “X4: Foundations - Scripts and Modding”