RimWorld

RimWorld

XML Extensions
 This topic has been pinned, so it's probably important
Imranfish  [developer] 16 Aug, 2021 @ 3:26am
Bug Reports
Please submit any bug reports here.

Currently known bugs:
- None
Last edited by Imranfish; 24 Sep, 2021 @ 5:35pm
< >
Showing 1-15 of 69 comments
Imranfish  [developer] 17 Aug, 2021 @ 5:32am 
- If UseSettings is applied after CreateSettings, it will overwrite your mod's label
Imranfish  [developer] 17 Aug, 2021 @ 8:09am 
Bug has been fixed.
Imranfish  [developer] 18 Aug, 2021 @ 6:31pm 
- Mods are sorted by the order they are loaded, not alphabetically.
Last edited by Imranfish; 18 Aug, 2021 @ 6:31pm
Imranfish  [developer] 19 Aug, 2021 @ 8:24pm 
Bug has been fixed.
Avericat 11 Sep, 2021 @ 3:37pm 
I am using
<Operation Class="XmlExtensions.ForEach"> <xpath>Defs/ThingDef[@ParentName and not(techLevel)]/thingSetMakerTags/li[text()="RewardStandardQualitySuper" or text()="RewardStandardMidFreq" or text()="RewardStandardLowFreq" or text()="RewardStandardHighFreq"]</xpath> <storeIn>DEF1</storeIn>
and it is giving an "Index was outside the bounds of the array" error.

Oddly, it works for some ThingDefs that it finds, but eventually errors, you can see this in the log files.

Here is the full log, the relevant part (I think) starts at the line 341:
https://gist.github.com/HugsLibRecordKeeper/434e6f7cbecf24706c37387f20ca3ebd

Here is the full operation that I am using.
https://pastebin.com/yhCeXzbV
Imranfish  [developer] 11 Sep, 2021 @ 9:47pm 
Fixed.
The Old One 29 Sep, 2021 @ 1:02pm 
Black screen issue reported in the Steam workshop comments
The game will load to a black screen and be unplayable. It started when XmlExtensions was updated this morning.

Taranchuk said it may be Argon's mod. It did start with today's XmlExtensions updated.

Issue happens for me only when XmlExtensions, Expanded Materials - Plastics and Expanded Materials - Metals (either normal or lite) are loaded together. both Expanded Materials mods are by Argon. Removing any one of the 3 resolves the issue. Issue shows when they + Harmony are the only 4 mods loaded.

I have the GOG version of Rimworld so can't post in the Workshop comments.
Imranfish  [developer] 29 Sep, 2021 @ 1:20pm 
Fixed, thank you for the report.
ASMR gaming 10 Nov, 2021 @ 9:40pm 
got this error log in my game not sure seems xml related XML error: Duplicate XML node name designatorDropdown in this XML block: <TerrainDef ParentName="FloorBase"><defName>WoodPlankFloor</defName><label>wood floor</label><renderPrecedence>250</renderPrecedence><description>Wood plank flooring for that warm, homey feeling. While it is quick to lay, it is also very flammable.</description><texturePath>Terrain/Surfaces/WoodFloor</texturePath><burnedDef>BurnedWoodPlankFloor</burnedDef><color>(108,78,55)</color><statBases><WorkToBuild>85</WorkToBuild><Flammability>0.22</Flammability></statBases><costList><WoodLog>3</WoodLog></costList><constructEffect>ConstructWood</constructEffect><designationHotKey>Misc9</designationHotKey><designatorDropdown>VFEArch_WoodFloor</designatorDropdown><designatorDropdown>OE_Floor_Tile_Wood</designatorDropdown></TerrainDef>
UnityEngine.StackTraceUtility:ExtractStackTrace ()
(wrapper dynamic-method) Verse.Log:Verse.Log.Error_Patch2 (string)
Verse.XmlInheritance:CheckForDuplicateNodes (System.Xml.XmlNode,System.Xml.XmlNode)
Verse.XmlInheritance:ResolveXmlNodeFor (Verse.XmlInheritance/XmlInheritanceNode)
Verse.XmlInheritance:ResolveXmlNodesRecursively (Verse.XmlInheritance/XmlInheritanceNode)
Verse.XmlInheritance:ResolveXmlNodesRecursively (Verse.XmlInheritance/XmlInheritanceNode)
Verse.XmlInheritance:ResolveXmlNodes ()
Verse.XmlInheritance:Resolve ()
(wrapper dynamic-method) Verse.LoadedModManager:Verse.LoadedModManager.ParseAndProcessXML_Patch3 (System.Xml.XmlDocument,System.Collections.Generic.Dictionary`2<System.Xml.XmlNode, Verse.LoadableXmlAsset>)
Verse.LoadedModManager:LoadAllActiveMods ()
Verse.PlayDataLoader:DoPlayLoad ()
Verse.PlayDataLoader:LoadAllPlayData (bool)
Verse.Root/<>c:<Start>b__6_1 ()
Verse.LongEventHandler:RunEventFromAnotherThread (System.Action)
Verse.LongEventHandler/<>c:<UpdateCurrentAsynchronousEvent>b__27_0 ()
System.Threading.ThreadHelper:ThreadStart_Context (object)
System.Threading.ExecutionContext:RunInternal (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool)
System.Threading.ExecutionContext:Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool)
System.Threading.ExecutionContext:Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object)
System.Threading.ThreadHelper:ThreadStart ()
Imranfish  [developer] 11 Nov, 2021 @ 4:17am 
@ASMR gaming, It seems like you either have a mod compatibility, or one of your mods you are using has a bug in it. The only information about the mod is that it affects the wooden floor terrain.
Sergkart 26 Nov, 2021 @ 12:02am 
Hello, I have more of a question than a bug report

I am the developer of the "kemomimilike" mod and with the help of your mod I was trying to make an autopatcher that will whitelist all the clothes that have no texture (no rendering while wearing) on my humanoid race, but I ran into a problem. The fact is that the autopatcher reaches the (conditionally) sixth item of clothing and gives an error.

What the patcher XML code looks like (almost completely as in the example of the autopatcher)

<Operation Class="XmlExtensions.ForEach">
<xpath>Defs/ThingDef/apparel/wornGraphicPath</xpath>
<storeIn>ApparelDef</storeIn>
<apply>
<Operation Class="XmlExtensions.CreateVariable">
<value>{ApparelDef}/defName</value>
<storeIn>defName</storeIn>
<apply>
<Operation Class="PatchOperationAdd">
<xpath>/Defs/AlienRace.ThingDef_AlienRace[defName="Alien_Valkyrie_WVC"]/alienRace/raceRestriction/blackApparelList</xpath>
<value>
<li>{defName}</li>
</value>
</Operation>
</apply>
</Operation>
</apply>
</Operation>
(This is an attempt with a blacklist, with a whitelist the same)

The error that is issued (there are about 60 of them differ only in numbers in brackets)

Could not resolve cross-reference to Verse.ThingDef named Defs/ThingDef[417]/defName (wanter=blackApparelList)
UnityEngine.StackTraceUtility:ExtractStackTrace ()
Verse.Log:Error (string)
Verse.DirectXmlCrossRefLoader:TryResolveDef<Verse.ThingDef> (string,Verse.FailMode,object)
Verse.DirectXmlCrossRefLoader/WantedRefForList`1<Verse.ThingDef>:TryResolve (Verse.FailMode)
Verse.DirectXmlCrossRefLoader/<>c__DisplayClass15_1:<ResolveAllWantedCrossReferences>b__0 (Verse.DirectXmlCrossRefLoader/WantedRef)
Verse.GenThreading/<>c__DisplayClass7_1`1<Verse.DirectXmlCrossRefLoader/WantedRef>:<ParallelForEach>b__0 (object)
System.Threading.QueueUserWorkItemCallback:WaitCallback_Context (object)
System.Threading.ExecutionContext:RunInternal (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool)
System.Threading.ExecutionContext:Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool)
System.Threading.QueueUserWorkItemCallback:System.Threading.IThreadPoolWorkItem.ExecuteWorkItem ()
System.Threading.ThreadPoolWorkQueue:Dispatch ()
System.Threading._ThreadPoolWaitCallback:PerformWaitCallback ()

Then I decided to check and tried this.

<Operation Class="XmlExtensions.ForEach">
<xpath>Defs/ThingDef/apparel/wornGraphicPath</xpath>
<storeIn>path</storeIn>
<apply>
<Operation Class="XmlExtensions.CreateVariable">
<value>{path}/defName</value>
<storeIn>defName</storeIn>
<apply>
<Operation Class="XmlExtensions.Log">
<xpath>{defName}</xpath>
</Operation>
</apply>
</Operation>
</apply>
</Operation>

And I got this

<defName>Apparel_CowboyHat</defName>
<defName>Apparel_BowlerHat</defName>
<defName>Apparel_TribalHeaddress</defName>
<defName>Apparel_Tuque</defName>
<defName>Apparel_WarMask</defName>
<defName>Apparel_WarVeil</defName>
<defName>Apparel_SimpleHelmet</defName>
<defName>Apparel_AdvancedHelmet</defName>

[kemomimilike - Start of stack trace]
XmlExtensions.Log(xpath='Defs/ThingDef[425]/defName'): Failed to find a node referenced by <xpath>
XmlExtensions.CreateVariable(storeIn='defName', value='Defs/ThingDef[425]/defName', value2=''): Error in <apply> in the operation at position=1
XmlExtensions.ForEach(path='Defs/ThingDef[425]', xpath='Defs/ThingDef/apparel/wornGraphicPath'): Error in <apply> in the operation at position=1
XmlExtensions.OptionalPatch(key='Valkyries_ApparelsExperimental_Checker_WVC', defaultValue='false'): Error in <caseTrue> in the operation at position=1
XmlExtensions.OptionalPatch(key='DisableGirls_Humanoids_WVC', defaultValue='true'): Error in <caseFalse> in the operation at position=7
Verse.PatchOperationSequence: Error in the operation at position=1
[End of stack trace]

If I understood correctly, then this will not work for what I wanted to do. Or is it a bug?
Imranfish  [developer] 26 Nov, 2021 @ 12:32am 
@Sergkart Oh! You need to add the node <fromXml>true</fromXml> to the CreateVariable operation; this will make it store the value inside of the <defName> node, rather than the xpath to it. I'm sorry for wasting your time, I have updated the wiki with the fix. Thank you for letting me know.
Sergkart 26 Nov, 2021 @ 12:51am 
@Imranfish, thanks for the quick answer, unfortunately I have already tried <fromXml>true</fromXml> and it does not solve the problem.

For "PatchOperationAdd"

[kemomimilike - Start of stack trace]
XmlExtensions.CreateVariable(storeIn='defName', value='Defs/ThingDef[425]/defName', value2=''): Failed to find a node referenced by <value>
XmlExtensions.ForEach(ApparelDef='Defs/ThingDef[425]', xpath='Defs/ThingDef/apparel/wornGraphicPath'): Error in <apply> in the operation at position=1
XmlExtensions.OptionalPatch(key='Valkyries_ApparelsExperimental_Checker_WVC', defaultValue='false'): Error in <caseTrue> in the operation at position=2
XmlExtensions.OptionalPatch(key='DisableGirls_Humanoids_WVC', defaultValue='true'): Error in <caseFalse> in the operation at position=7
Verse.PatchOperationSequence: Error in the operation at position=1
[End of stack trace]

For "XmlExtensions.Log"

[kemomimilike - Start of stack trace]
XmlExtensions.Log(xpath='Apparel_CowboyHat'): Failed to find a node referenced by <xpath>
XmlExtensions.CreateVariable(storeIn='defName', value='Defs/ThingDef[417]/defName', value2=''): Error in <apply> in the operation at position=1
XmlExtensions.ForEach(path='Defs/ThingDef[417]', xpath='Defs/ThingDef/apparel/wornGraphicPath'): Error in <apply> in the operation at position=1
XmlExtensions.OptionalPatch(key='Valkyries_ApparelsExperimental_Checker_WVC', defaultValue='false'): Error in <caseTrue> in the operation at position=2
XmlExtensions.OptionalPatch(key='DisableGirls_Humanoids_WVC', defaultValue='true'): Error in <caseFalse> in the operation at position=7
Verse.PatchOperationSequence: Error in the operation at position=1
[End of stack trace]

I think I should clarify that this problem occurs only in my case, since the example worked for me. (old version without fromXml)
Imranfish  [developer] 26 Nov, 2021 @ 1:05am 
@Sergkart The error is saying that the xpath couldn't be found: Defs/ThingDef[425]/defName. So that means your original xpath Defs/ThingDef/apparel/wornGraphicPath is iterating through a ThingDef that has an apparel/wornGraphicPath node, but does not have a defName. Maybe it is iterating an Abstract def? You might have to add some checks, or use FindNodeInherited/ConditionalInherited to deal with inheritance.
Sergkart 26 Nov, 2021 @ 1:09am 
@Imranfish, stupid me.. I completely forgot about abstract things. Thanks for the tip.

Since I'm here, I think it's worth mentioning a non-critical bug. Now I will try to explain:

If you try to add to "XmlExtensions.Setting.EmbedMenu" a list of settings with "XmlExtensions.Setting.SplitColumn" or anything similar, you get this error

[Start of stack trace]
XmlExtensions.Setting.SplitColumn: Failed to initialize:
An item with the same key has already been added. Key: System.Collections.Generic.List`1[XmlExtensions.Setting.SettingContainer]
XmlExtensions.SettingsMenuDef(TEST_Settings_GeneralWVC): Error in initializing a setting at position=25
[End of stack trace]

Example:

<li Class="XmlExtensions.Setting.EmbedMenu">
<menu>TEST_Settings_GeneralWVC</menu>
</li>

Contains this:

<li Class="XmlExtensions.Setting.SplitColumn">
<leftCol>
<li Class="XmlExtensions.Setting.Text">
<text>All girls</text>
</li>
<!-- And more settings -->
</leftCol>
<rightCol>
<li Class="XmlExtensions.Setting.Textbox">
<key>girls_tough_wvc</key>
<label> </label>
<defaultValue>0.5</defaultValue>
</li>
<!-- And more settings -->
</rightCol>
</li>

The settings work, it just gives an error.

I solved this problem like this:

<li Class="XmlExtensions.Setting.SplitColumn">
<leftCol>
<li Class="XmlExtensions.Setting.EmbedMenu">
<menu>Settings_General_Damage__TextWVC</menu>
</li>
</leftCol>
<rightCol>
<li Class="XmlExtensions.Setting.EmbedMenu">
<menu>Settings_General_Damage_WVC</menu>
</li>
</rightCol>
</li>
< >
Showing 1-15 of 69 comments
Per page: 1530 50