Been trying to mod; Seems error in mod parser. (Its not my code.)

Pichii

Refugee
Version
2.3
Platform
Windows
Hi there pimps I got a strange one for you today.
Ive been dabbling in MODs recently; making my own.
I tinkered around and got a spawning mod working and that has been a great time.
I decided to expand and attempt to do a Learn By Doing system in 7d2d for v2.3.
A little preamble- I can code in 8 differnt languages. If you wish, I can give you a link to my project folder containing working code in said languages. I mention because I know this report is gona get frowned at.

I decided to logically program the 'brain' of the code into buffs as buffs allows me to easily check EXP variables with the buff, cycle through and properly apply a 'level up' this 'level up' gives a perk point as if one read a crafting skill book.
For this mod to work, I needed buffs.xml edit, items.xml edit and recipies.xml edit.
I decided to use Gemini a bit as there was alot of repetitive work and I have the premium version. Gemini with my help managed to output 2 working xmls, buffs and recipies. (Also note the aforementioned spawning mod, made the same way and WORKS.)

Now for the issue at hand;
items.xml is either
A. So chaotic, nobody can figure out how it works (Gemini and I have tried for 7 days to find a template, common logic system, for items but nothing works. game cannot parse.
B. I tried xpath but xpath append and modify but parser cannot accurately link <properties> or <groupeffect> to mod the logic for "Add exp on item swing completion" game cannot parse.
C. I tried simply removing all sections of vanilla with remove functions and then added my variables with a copy of the vanilla code for action0 and action1 game cannot parse.
D. I fed this info through gemini/clyde for a week along with myself helping it with the logic. It keeps coming back to "Replace everything because the parser cannot detect even its own variables to parse."

Im simply trying to do this with XML edits and parser. I dont wana have to C my way in, its ultra complex. Alas, I may have to because the mod parser cant parse.
I do not know if its too complicated or what.
If I attempt to append action0 or action1, the game cannot parse it even if the code/logic is correct.

This bit should be the easy part;
find action0 and action1 (Use action1 only if a "Power Attack" is found.)
append EXP variable to action0/action1 and add exp on selfPrimaryActionEnd and selfSecondaryActionEnd for governing crafting exp.

The game cannot parse this simple code.
I think the game parser is broken OR, items.xml is such a cluster fudge mess, nobody, not even the robots themselves can understand it and/or make it work...
I have included my current modlet just so verification can take place. Please let me know if im just a fool or if this is a legitimate bug. I wana pull my hair out over this.
EVERYTHING except items.xml (items.txt for upload) works and the mod parser got em just fine. Its ONLY items.xml that is the issue and its because items.xml has nothing standardized, no template and there are some unique entries as well which make it exceptionally difficult if not impossible to mod 7d2d and im unsure my logic/code is to blame at this point; particularly when multiple AI have claimed; "There is an issue with the mod parser."
Thanks in advance.
 
Reproduction Steps
Madke a modinfo file, put those in with the mod, put in mod folder.
Link to Logs
https://pastebin.com/ywNqHmv9
Link to Screenshot/Video
https://pastebin.com/ywNqHmv9

Attachments

PS: I used gemini to make a working Zombie Spawning modlet.
I did this simply by editing values in the <biomes> area of spawning.xml.
It has the same error; if I modify maxspawn and/or the per-day lockouts for spawning; the mod cannot parse.
However, THIS bug was fixed by <remove> and <replace> and I belive this worked because only 1 small section needed removal and apply.
It seems the game detests anything that isnt a vanilla xml edit in core files. Modding these same things in via parser causes parser error that requires removal workaround.
 
PPS: I wanted to upload my psudocode and logic too. I have tried a few differnt methods to try to workaround. The uploaded items.xml is the result after gemini thinks there is a mod parser error. The psudocode is from the start before the mod parser potential error was found.
 

Attachments

And finally, debugging from Gemini and why it thinks its a parser bug:

Here is a summary of our debugging process and the core problem with the game's XML parser.



What We Have Tried and Why It Failed​



  • Initial Fixes (&lt;append xpath=".../effect_group"&gt;): Our first attempts focused on using precise XPath queries to append your triggered_effect code to the &lt;effect_group&gt; of each item. This method was the correct approach in principle, but it failed because many items in the base game's items.xml file do not have an &lt;effect_group&gt; tag nested directly within their Action0 or Action1 properties. When the game's parser couldn't find the target element, it generated the WRN XML patch...did not apply error for every single entry, causing the mod to fail entirely.
  • Aggressive Fixes (&lt;remove&gt; and &lt;append&gt;): In an attempt to force the mod to load, we tried a more aggressive strategy: completely removing each item's definition and then re-appending a new, complete definition. This initially seemed promising, but it led to a fatal error: EXC Extends item ... is not specified for item ...'. This critical error revealed a flaw in my understanding. The game relies on the Extends attribute to link parent items to their children. When a parent item was removed, the children could no longer find their parent's definition, and the entire mod would fail to load.


The Core Problem with the Parser​



The issue is not with your code itself but with the game's XML parser, which is both extremely sensitive and inconsistent. The problems are:

  1. Inconsistent File Structure: The XML structure is not uniform across all items. For some items, an &lt;effect_group&gt; exists within a &lt;property&gt; tag, while for others, it does not. This is why a single patching method failed for all items.
  2. Strict Inheritance Rules: The parser is unforgiving when it comes to parent-child dependencies. As we discovered, simply removing and re-adding an item, even with a complete definition, can break the inheritance chain if other items extend it. This is a major limitation that requires a different approach.
Your observation about special items like the TazasStoneAxe and the CandyClub was also key. These items have unique definitions that can cause parsing errors if they are not handled correctly.

In Summary; items.xml is so complicated, unless you made the file yourself, its nonsensical.
Certain entries like Clubs and Sledgehammers have structure from A16. Others like Knives have a unique structure. Even more others like Baton has a template structure. Please add items.xml to your list of 'please reorganize quickly' so that modders can mod. ;)
 
Last edited:
Lemme be a little more frank;
items.xml is not documented in a way that someone outside of the 7d2d dev team can 'jump in' and use it.
The parent/child dependancies need syntax that isnt apparent and is also very strict.
Furthermore, because some items have properties that others do not and there is no template for any of it; again documentation falls short on being able to 'jump in' and code/mod without having been on the development team.

Ill accept defeat insomuch as "intended functionality"
However, I still insist this is a valid bug report as;
documentation for items.xml is insufficent for a modder to be able to easily jump in and mod.
Clarity for Parent/Child syntax and proper use is critical.
some semblance of using a template for item entries would be incredibly helpful to people wanting to mod.
Some items need to be updated to the new format rather than like, 'clubs' having A16 code for the item... Literally even knives with the PHD of effects they have are about == to the code for clubs. Its very messy and hard to read and understand.
I know the pimps have already said code cleanup was happening so, its a known... issue? That they are working on. recipies.xml has the new system and it was incredibly easy to understand and mod despite it being some of the harder bits to properly link in due to the differences in code/effects.
PS: My sincere heartfelt thanks to whomever it is doing the code cleanup. Much apreciated effort! :)
 
Last edited:
Back
Top