Ludeon Forums

RimWorld => Mods => Help => Topic started by: Xnope on May 24, 2017, 02:59:35 PM

Title: [A17] XML Patch causes black screen
Post by: Xnope on May 24, 2017, 02:59:35 PM
After "InitializingInterface" but before "Loading Defs" appears, this patch causes the game screen to go black and the music doesn't even start playing:


<Patch>
  <Operation Class="PatchOperationReplace">
    <xpath>//StatDef[defName = "MiningYield"]/</xpath>
<value>
  <maxValue>1.15</maxValue>
</value>
  </Operation>
</Patch>


Perhaps I just don't quite understand how patching works? I was using a def override before but decided since I was changing just his one value to give xml patching a stab.
Title: Re: [A17] XML Patch causes black screen
Post by: Xnope on May 24, 2017, 03:33:11 PM
Update: a silly typo caused the black screen. Spelling matters people!

For the interested: the forward slash after //StatDef[defName = "MiningYield"] caused the black screen. Also the proper xpath would have been

<xpath>//StatDef[defName = "MiningYield"]/maxValue</xpath>
Title: Re: [A17] XML Patch causes black screen
Post by: Sp0nge on July 17, 2017, 11:16:30 AM
Im trying the same as you did here, but Im not able to get it working. Did yours work?
Title: Re: [A17] XML Patch causes black screen
Post by: Xnope on July 17, 2017, 04:02:53 PM
Yes triple check all spelling. The last char in your xpatch should not be a forward slash. See the second code in my last comment. After this, you still have to do


<value>
    <maxValue>1.15</maxValue>
<value>


or whatever you patch entails.

If you still have problems, I love solving problems, so post your code here.
Title: Re: [A17] XML Patch causes black screen
Post by: Sp0nge on July 17, 2017, 05:42:46 PM
Got it fixed, tnx for the offer!
Title: Re: [A17] XML Patch causes black screen
Post by: faltonico on July 20, 2017, 05:32:31 AM
Quote from: Xnope on May 24, 2017, 03:33:11 PM

<xpath>//StatDef[defName = "MiningYield"]/maxValue</xpath>


Using // causes long loading times, or something like that.... In short it is not good to do that.
It searches everywhere on all the defs according to some of the tutorials here in the help forum.
Title: Re: [A17] XML Patch causes black screen
Post by: skullywag on July 20, 2017, 07:20:58 AM
Aye:

/StatDefs/StatDef[defName = "MiningYield"] would be much faster (or whatever the 1st xml parent node in the relevant file is)

even */StatDefs/StatDef[defName = "MiningYield"] would be faster.
Title: Re: [A17] XML Patch causes black screen
Post by: Xnope on July 21, 2017, 04:55:41 AM
Oops yeah I forgot to look at my actual code before replying to Sp0nge's question. What I actually had in the patch was

<xpath>/Defs/StatDef[defName = "MiningYield"]/maxValue</xpath>