A second pair of eyes needed [xpath]

Started by Sixdd, December 17, 2019, 06:07:21 AM

Previous topic - Next topic

Sixdd

So I've done some modding before and even worked with xpath patches in the past but now I think I may be a bit rusty. I've checked the xpaths and this should work but I cannot for the life of me get it to work at all.
<?xml version="1.0" encoding="utf-8" ?>
<Patch>

<Operation Class="PatchOperationSequence">
<success>Always</success>
<operations>
<li Class="PatchOperationTest">
<xpath>Defs/ThingDefs[defName = "AEXP_WalrusTusk"]</xpath>
</li>
<li Class="PatchOperationAdd">
<xpath>Defs/RecipeDef[defName = "carve_ivory_figures"]/ingredients/li/filter/thingDefs</xpath>
<value>
<li>AEXP_WalrusTusk</li>
</value>
</li>
<li Class="PatchOperationAdd">
<xpath>Defs/RecipeDef[defName = "carve_ivory_figures"]/fixedIngredientFilter/thingDefs</xpath>
<value>
<li>AEXP_WalrusTusk</li>
</value>
</li>
<li Class="PatchOperationAdd">
<xpath>Defs/RecipeDef[defName = "carve_ivory_figures"]/defaultIngredientFilter/thingDefs</xpath>
<value>
<li>AEXP_WalrusTusk</li>
</value>
</li>
</operations>
</Operation>

</Patch>



Basically I've updated the B19 mod "Ivory and Jade Carving" so that more people can enjoy it. The patch is to add another mods animal horns to the recipe but I've tweaked and changed it in every way possible but just cannot get it to work. Any help is super appreciated.

LWM

First off, I did some testing and "/Defs/..." is slightly faster than "Defs/...", so I would switch all of your xpaths to that.  If you want, you can see what I did in the xpath post, or on my github page (google github littlewhitemouse).

You're trying to add AEXP_WalrusTusk as a possible ingredient for carve_ivory_figures?

Are you sure the entire path already exists in the recipe?  Are you sure everything is spelled correctly?  I don't have the RecipeDef, so cannot doublecheck that.

Actually, have you tried running the patch without <success>Always</success>?  Error messages might be helpful!

Sixdd

Excellent suggestions, I'll see what the log says without the success line.