help with xpath error

Started by delheit, June 08, 2017, 06:03:30 PM

Previous topic - Next topic

delheit

Not sure why this isnt working

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

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

<Patch>

<Operation Class="PatchOperationReplace">
    <xpath>/ThingDefs/ThingDef[defName = "Wall"]/costStuffCount</xpath>
    <value>
                <costStuffCount>10</costStuffCount>
    </value>
</Operation>

</Patch>


gives me

Patch operation Verse.PatchOperationReplace(/ThingDefs/ThingDef[defName = "Wall"]/costStuffCount) failed

milon

I haven't gotten into this yet, but skullywag has created a help thread here:
https://ludeon.com/forums/index.php?topic=33186.0

kaptain_kavern

You have not used the correct parent node.

Xpath should start by Buildings/ThingDef/....

delheit

#3
Quote from: milon on June 08, 2017, 08:27:33 PM
I haven't gotten into this yet, but skullywag has created a help thread here:
https://ludeon.com/forums/index.php?topic=33186.0

Thanks i asked over there as well and with an example that is similar but working.


Quote from: kaptain_kavern on June 08, 2017, 10:13:13 PM
You have not used the correct parent node.

Xpath should start by Buildings/ThingDef/....

Thanks, I'm not sure if i did it wrong but just replacing ThingDefs with Buildings didn't get it working. Tried a few similar things as well /Buildings/ThingDef/

Sorry i am completely new to xpath not xml necessarily but this part totally new.


Update: I got it to work but I think in the inefficient way.

<xpath>//ThingDef[defName = "Wall"]/costStuffCount</xpath>

skullywag

As i stated in the surgery thread I think youve used costStuffCount which as far as I can see doesnt exist on mineable walls as they arent buildable in core.
Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?