NQualityOfLife.XML.AddOrReplaceIfExists - Niilo007/RimWorld-NQoL GitHub Wiki

AddOrReplaceIfExists

Related:


XML

<Operation Class="NQualityOfLife.XML.AddOrReplaceIfExists">
    <xpath>string</xpath>
    <toVar>string</toVar> <!-- Optional -->
    <value>

    </value>
    <doesNotExist Class="PatchOperation"> <!-- Optional -->

    </doesNotExist>
    <done Class="PatchOperation"> <!-- Optional -->

    </done>
    <error Class="PatchOperation"> <!-- Optional -->

    </error>
</Operation>

Usage

  • If <toVar> is provided, the given <xpath> is saved to it.
    • Variable names must begin and end with '{' & '}'

<xpath>

Supports variables.


<applyVariables>

Apply variables to the xpath and to the text contained in value?


<toVar>

The xpath gets stored in this variable if provided.


<count>

tba


<done>

The patch operation to perform when this one has completed successfully.


<error>

The patch operation to perform if this one fails or errors.


Errors


Examples

Used In Example:

<Operation Class="NQualityOfLife.XML.AddOrReplaceIfExists">
    <xpath>
        Defs/ResearchProjectDef
        [defName[contains(text(),"Net")]]
        [defName[contains(text(),"Fish")]]
        [not(defName="NQoL_Trapping_Research")]
    </xpath>
    <value>
        <researchViewX>2.00</researchViewX>
        <researchViewY>4.80</researchViewY>
    </value>
    <doesNotExist Class="NQualityOfLife.XML.Log">
        <warning>Did not find any fish trap researches to patch!</warning>
        <debug>true</debug>
    </doesNotExist>
</Operation>

⚠️ **GitHub.com Fallback** ⚠️