PDA

View Full Version : modding .mods



gmkieran
July 14th, 2011, 22:45
Good evening! I'm not much for xml, but I'm trying to make some additions/changes to the standard Savage Worlds GMG and PG files to give them a somewhat different flavor. I want to keep the revised versions separate from the standard versions, so I've started by changing the initial name string (throughout the db.xml) and made some changes to some of the text, but none to any of the XML. My original file works fine in FG. My revised file won't even *appear* in FG unless I add a random </#####> tag to the bottom. With that tag, whatever it is, the file will appear in FG to be opened and will then appear in the Library, but contains no tables, text or links when selected.

I've compared the 2 files using Notepad++ and confirmed that the only changes are the ones noted above; xml is *exactly* the same. I've also tried the IE trick. IE will display all text in the revised file *if* I have the additional close tag in place. It will *not* display the *original* file without that same close tag. Btw, IE no longer identifies *where* code broke, just that it did.

So, with no xml changes, why would one file display and one not? And why would adding a close tag not associated with any open tag make any difference at all?

I'm so confuuuuuuuuuuused!
thanks, as always!
GMK

phantomwhale
July 15th, 2011, 00:07
Off the top of my head... not sure.

Guess posting the mod on the forum isn't ideal (slight breach of copyright) but feel free to send over the .mod file you've created to Ben DOT turner AT pobox DOT com (I've got a copy of the ruleset, promise ;)) and I'll take a quick look.

Regards,
Ben (-PW-)

Phystus
July 15th, 2011, 00:08
Try it in another XML validator. There's one here (https://www.w3schools.com/xml/xml_validator.asp), see what sort of error it throws. Maybe it will help you track it down.

~P

Griogre
July 15th, 2011, 02:53
Also, if you have two modules that have the same name element, most of the time neither will appear. This may well be your problem. IE the red text, usually on the 3rd or 4th line in most library modules must be unique. From ENGM module:



<?xml version="1.0" encoding="ISO-8859-1" ?>
<root version="2.0">
<library>
<ENGM static="true">
<name type="string">EN GM Guide</name>


So if you are changing the SWEX library modules make sure you change the name element to be something other than SWEX GM Guide and SWEX Player Guide.

gmkieran
July 15th, 2011, 14:21
thanks, Phantomwhale, I'll pass it along in a couple. Phystus, I did try that one as well as validator.w3.org and beyondcompare - none of them threw an error (with or without the extra closing tag), but none of them seem to have a broken pair detector. Griogre, that was the main change I made to the file - that name and then all the relevant links that refer to it. The original file does appear, the revised file does not (unless I add the additional closing link).

cheers!
GMK

Zeus
July 15th, 2011, 15:19
thanks, Phantomwhale, I'll pass it along in a couple. Phystus, I did try that one as well as validator.w3.org and beyondcompare - none of them threw an error (with or without the extra closing tag), but none of them seem to have a broken pair detector. Griogre, that was the main change I made to the file - that name and then all the relevant links that refer to it. The original file does appear, the revised file does not (unless I add the additional closing link).

cheers!
GMK

Sounds like somewhere, one of your edits, has inadvertently changed the tag structure. Hence why adding a closing tag to the end of the file is allowing the module to appear.

I would check through your edits, paying particular attention to any changes where " or ' are used. Make sure they are all closed properly.

The easiest way of finding **ALL** the differences, is to load both versions of the .xml into Notepad++ and running the Diff/Compare plugin to highlight those lines that are different. Then its a case of comparing each one line by line to see where the problem lies.

gmkieran
July 15th, 2011, 18:34
Thanks, DrZ. Unfortunately, that's exactly what I did, both in Notpad++ and BeyondCompare. The only differences either of them noted were the changes made to name and text. The tags were exactly the same in both files. I think I've made some changes to my file (the one I sent you, Phantomwhale) since I did the comparison, trying to figure out what was broken, but at the time I did the compare the files were identical as to tags and the original worked, while the edited did not. :(

Griogre
July 15th, 2011, 18:57
If the XML is validating, then like DrZeuss says it is likely to be something subtle in an attribute like straight " vs. a slant “ mismatch or missing the =. Or maybe a > in the data entry. Those can be a pain to find. :(

gmkieran
July 15th, 2011, 19:43
Indeed, it was! I finally found a validator, here: https://www.w3schools.com/xml/xml_validator.asp, that would identify the broken tags. It swears up and down that the db.xml file I sent you, Phantomwhale, is perfect *if I take out the extra close tag that makes it display in IE*. However, it successfully identified about 6 broken tags in the common/client xml files for the players guide. I won't know 'til I get home and can try to load them whether the fixes actually work, but it's progress, I guess. :D

Thanks, as always!
GMK

gmkieran
July 16th, 2011, 03:52
Heyo! Both edited files worked this evening. Interesting side-effect - if I had both the originals and the edited mods open, the edited mods showed the original index structure and content. When I closed the originals, the edited mods showed the edited structure and content. I'm putting this down to not having changed any of the ID's throughout either file, yet, but it was interesting to note. Thanks again for the suggestions!

Cheers!
GMK

Griogre
July 17th, 2011, 04:27
The merging is expected behavior. If you don't want things to merge then change the Library link names and the outermost element name for the data. IE


<?xml version="1.0" encoding="ISO-8859-1"?>
<root version="2.0">
<library>
<swrulesgm static="true">
<name type="string">SW GM Rules</name>
<categoryname type="string">Savage Worlds Rules</categoryname>
<entries>
lots of links...
</entries>
</swrulesgm>
</library>


This will stop the links from combining in the library link list. Most SW library modules put their data in a reference section:



<referenceSWGM>
<npcs>
npc data...
</npcs>
and all the rest of the data...
</referenceSWGM>

Making the outer reference container elements names unique will make sure none of the data merges. Sometimes merging things is useful because you don't have to repeat the extra data if it has not changed you can just add new things.

phantomwhale
July 17th, 2011, 10:16
GMK,

Just checked the file you sent me (clearly you've fixed it now), but as a heads up, my copy of Notepad++ pick up and error straight away, which was:

https://i.imgur.com/79FB1l.jpg (https://imgur.com/79FB1)

Now that is not a USEFUL error message - all it's saying is it got to the end of the file, and it's not parsed correctly. The error could be anywhere.

However, by messing about with the folding keys (ALT + number, ALT + SHIFT + 0 to unfold all) you can quickly see where stuff goes awry. In the image above, you can see there are two </library> tags - the cause of the issue ! The fix; delete line 5636.

You can make sure Notepad++ always flags up such errors upon saving the file by enabling auto-check in the XML tools menu :

https://i.imgur.com/lx0lzl.jpg (https://imgur.com/lx0lz)

Or you can trigger a manual check from the menu too, if you prefer. Autocheck stops me testing busted code though, so I always code with in on, especially when doing library modules.

Glad you've got it fixed anyway, hopefully this will help for next time though (and confirm that the file WAS bust !)

Cheers,
Ben (-PW-)

gmkieran
July 17th, 2011, 13:20
Thanks for the tips on Notepad++! I'm just starting to use it and haven't figured out most of the functionality. Looking at my copy, though, I don't have an xml tools plugin, so I don't have the checker you're using. Is it something you downloaded separately or have I gotten an incomplete copy of the software? The extra /library tag was what I added to get the software to display in IE - if you run it in IE without that, it breaks, which is weird.

Thank you for the headsup on how to break the ID merging, Griogre! I'll play around with it and see what I need to change and what I can keep for best efficiency.

Cheers!
GMK

phantomwhale
July 17th, 2011, 13:26
Think XML tools is standard with the latest version. Before that it was a plugin you can download from the sourceforge plugins page, or via the inbuilt plugin manager in notepad++ (which is easier, if it works).

Yeah, I'd leave IE alone for XML testing. And web browsing for that matter :)

Trenloe
July 17th, 2011, 13:29
Thanks for the tips on Notepad++! I'm just starting to use it and haven't figured out most of the functionality. Looking at my copy, though, I don't have an xml tools plugin, so I don't have the checker you're using. Is it something you downloaded separately or have I gotten an incomplete copy of the software?

In Notepad++ go to Plugins -> Plugin Manager -> Show Plugin Manager, select and install "XML Tools". Then you will have the Plugins -> XML Tools option.

Edit: phantomwhale beat me to it on this one... :)

gmkieran
July 19th, 2011, 19:36
Thanks to both of you! I'll go grab that - desperately need it if I'm gonna keep messing with these xml thingies. As for IE, yeah, I avoid it every opportunity I get, but it's nearly always the first recommendation for tracking down broken xml (which made more sense when it actually told you where the break was).

Anyway, cheers!
GMK