RimWorld

RimWorld

Ei tarpeeksi arvosteluja
ObjPath tester + CDATA tester
   
Palkinto
Lisää suosikkeihin
Lisätty suosikkeihin
Poista suosikeista
Mod, 1.4, 1.5, 1.6
Tiedostokoko
Julkaistu
Päivitetty
612.732 KB
4.11.2022 klo 5.01
11.7. klo 3.17
3 muutosilmoitusta ( näytä )

Tilaa ladataksesi
ObjPath tester + CDATA tester

1 kokoelmassa, tekijä test
test's mods
19 luomusta
Kuvaus
This tool allows you to validate objPaths in-game. it is a modding tool, it has no impact on gameplay.

Menu at Options - '+' - objPath tester.


objPath tester
DefDatabase operations in XML Extensions allow you to modify stuff that you can't patch with just XML, and you can apply them without having to restart the game. They use objPath instead of XPath, so you can validate your objPaths with this mod.
https://github.com/15adhami/XmlExtensions/wiki/Using-DefDatabase-Operations for more info on DefDatabase operations.

This mod can only output the objPath results to log. It isn't the most convenient way but still very useable.


Rich Text tester
Rich Text has nothing to do with objPath and DefDatabase operations, but I included it for no particular reason. You can use CDATA to add unity3D Rich Text formatting to any text strings in your mod, such as labels and descriptions.
https://docs.unity3d.com/Packages/com.unity.ugui@1.0/manual/StyledText.html for more info on Rich Text formatting that you can use inside CDATA.

Basically you can put <![CDATA[some text]]> into any string, and put Rich Text formatting inside. For example <![CDATA[<b><color=green>Shrek</color><b>]]> will look be green bold text saying "Shrek".


This mod also has no custom code, it is in fact an extemely simple XML mod which just combines some XML Extensions functions.

Note that I have very little knowledge of what objPath actually is, I originally wanted an xpath tester that showed results after applying patch operations, but it didn't work. But replacing xpath with objpath worked so here it is, even though I don't really know how to use it and how useful this is
16 kommenttia
NuanKi 25.6.2024 klo 0.33 
Thanks, looks like i would need to repeat for each one, or simply use the default "required restart to apply"
test  [tekijä] 24.6.2024 klo 23.48 
@NuanKi I don't think that's possible, the game resolves parents meaning their nodes are copied into all children, before creating defdatabase. The parent thing is more of a convenience for modders and no longer exists at that stage
NuanKi 24.6.2024 klo 21.51 
this is what i make, and it works, but how can we specify all the defs with the same parent, in this case FlagstoneBase:
TerrainDef/[defName="FlagstoneGranite"]/costList/*
NuanKi 24.6.2024 klo 21.18 
Do you know how and where i can see the objPath of an item?
yavis 4.11.2022 klo 11.29 
I tested it and it passed!
The last code you posted is correct.
Because this code has many entries, as long as one of them is wrong, all of them will report the same error.
yavis 4.11.2022 klo 8.19 
Well, thank you again - - I'll try:steamthumbsup:
test  [tekijä] 4.11.2022 klo 7.56 
@yavis not sure if that is the issue but you need to add a node inside valu like in normal patch operations, like this
<Operation Class="XmlExtensions.DefDatabaseOperationReplace">
<objPath>HediffDef/[defName = "ControlSublinkImplant"]/stages/[1]/statOffsets/[stat/defName="WorkSpeedGlobalOffsetMech"]/value</objPath>
<value>
<val>52</val><!--The name of the node doesn't matter, only the inner text will be parsed-->
</value>
</Operation>
yavis 4.11.2022 klo 7.40 
You then add a DefDatabaseOperationReplace Go in -, -
yavis 4.11.2022 klo 7.35 
DefDatabaseConditional
ok
DefDatabaseLog
ok
DefDatabaseOperationReplace
Failed to find a node referenced by <objPath>

:steamfacepalm:

<Operation Class="XmlExtensions.DefDatabaseOperationReplace">
<objPath>HediffDef/[defName = "ControlSublinkImplant"]/stages/[1]/statOffsets/[stat/defName="WorkSpeedGlobalOffsetMech"]/value</objPath>
<value>52</value>
</Operation>
yavis 4.11.2022 klo 6.41 
You can call Imranfish
Let him edit the wiki again,:steamhappy:
Thank you so much!