RimWorld

RimWorld

Not enough ratings
ObjPath tester + CDATA tester
   
Award
Favorite
Favorited
Unfavorite
Mod, 1.4, 1.5, 1.6
File Size
Posted
Updated
612.732 KB
Nov 4, 2022 @ 5:01am
Jul 11 @ 3:17am
3 Change Notes ( view )

Subscribe to download
ObjPath tester + CDATA tester

In 1 collection by test
test's mods
19 items
Description
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 Comments
NuanKi Jun 25, 2024 @ 12:33am 
Thanks, looks like i would need to repeat for each one, or simply use the default "required restart to apply"
test  [author] Jun 24, 2024 @ 11:48pm 
@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 Jun 24, 2024 @ 9:51pm 
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 Jun 24, 2024 @ 9:18pm 
Do you know how and where i can see the objPath of an item?
yavis Nov 4, 2022 @ 11:29am 
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 Nov 4, 2022 @ 8:19am 
Well, thank you again - - I'll try:steamthumbsup:
test  [author] Nov 4, 2022 @ 7:56am 
@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 Nov 4, 2022 @ 7:40am 
You then add a DefDatabaseOperationReplace Go in -, -
yavis Nov 4, 2022 @ 7:35am 
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 Nov 4, 2022 @ 6:41am 
You can call Imranfish
Let him edit the wiki again,:steamhappy:
Thank you so much!