PDA

View Full Version : 4e Parser giving double power entries?



lady2beetle
September 4th, 2010, 16:14
First of all, thanks for all the help you guys have given me so far. I really appreciate it. :) Also, I hope it's okay for me to ask this here. I know it's not technically about the FG2 program...

I've been trying to use the 4e parser to snag the 4e rules from the compendium (I do have a DDI subscription). The items are going fine, the monsters are tricky, but I understand that's because Wizards is "tweaking" them (*cough*uprooting and replanting upside down?*cough*). My question is about the powers. For some reason, when I parse them into a FG2 library, they get... doubled? When I go into FG2, I have exactly 2 copies of every power. I've checked the scraped document, but there's only 1 of each power, so I'm not sure what I'm doing to cause it to double-parse each power. Does anyone have any suggestions?

EugeneZ
September 4th, 2010, 19:33
Is it possible you have another module with the same modestring that also has all the powers? Try closing all your modules except the one you scraped.

Griogre
September 4th, 2010, 21:15
What EugeneZ is saying is the modestrings have to be unique for each module if you don't want different modules to combine. If they are not then entries will be combined from open modules with the same modestring. Using the parser you always want the module's modestring to be unique unless you plan to modify them by hand.

It's also possible that you accidentally made two modules. IE you did a test run of a few powers, monsters, etc. and then ran the parser again meaning to overwrite the old module but instead changed the name of the new module so you actually have two modules with overlapping content. That's easy to fix just go into FG's data app module folder and delete any extra modules. You will probably want the largest and latest version of the module.

To get to the modules folder press the Start Button -> All Programs -> Fantasy Grounds II -> Application Data and you will pop a window that shows the modules folder.

zapoqx
September 5th, 2010, 00:29
If you don't mind me getting in on this since its roughly about the same topic...
I don't see powers double like lady2beetle is, but usually I'll see the items double and triple if I have more than one module opened involving items. It will duplicate itself for each module that has items. Example:
PHB1 opened - Magic items are fine.
Adventurer's Vault 1 opened - Both this and the PHB1 magic items are now duplicated.
Adventurer's Vault 2 opened - Now this, AV1, and PHB1 magic items are now duplicated thus an item appears 3 times.

Is this also a modestring issue? If so, how can it be fixed?

lady2beetle
September 5th, 2010, 05:18
Thank you, EugeneZ & Griogre! Hopefully you can help zapoqx, too.

As for my issue, I confess that I have been leaving the modestring entry blank, because it says "(optional)" and because I had no idea what to enter there. Is that my problem? O.o

Meanwhile, I have a totally different problem now. Now when I try to parse powers that I've just scraped, I am getting an error saying that the "\" character is not allowed. When I open up the scraped file, I find a lot of "\r"'s that I believe are supposed to be carriage returns. I can go through and replace them all manually, but a) there are a LOT of them and b) I then get messages that the lines are super long when I try to parse it.

Any ideas on this one? Should I replace the "\r" with "/r"?

Griogre
September 5th, 2010, 06:38
Is this also a modestring issue? If so, how can it be fixed?
Yes it sounds like it is. See below.


As for my issue, I confess that I have been leaving the modestring entry blank, because it says "(optional)" and because I had no idea what to enter there. Is that my problem? O.o

Yes this is the problem all you modules have the same name element, in this case: <name type="string"> </name> so they all combine. See below.

zapoqx & lady2beetle: You might find this step by step example instruction helpful on how to use the 4E parser, its from the FG Wiki: http://oberoten.dyndns.org/fgwiki/index.php/Creating_Modules

Specifically before you parse you need to add a different modestring to each module. I'd use strings like 4ePH, 4ePH2, 4ePH3 for the Player's Handbooks, 4eMM, 4eMM2, 4eMM3 for the monster manuals, 4eDMG and 4eDMG2 for the DMGs, 4eAV, 4eAV2 for the Adventurer's Vaults, etc. The modestring is the internal module name, I'm not really sure why Tenian called it modestring - as you can see above, the actual XML element is called name but I guess he thought calling it name would be too confusing and too easy to confuse with the file name.


Meanwhile, I have a totally different problem now. Now when I try to parse powers that I've just scraped, I am getting an error saying that the "\" character is not allowed. When I open up the scraped file, I find a lot of "\r"'s that I believe are supposed to be carriage returns. I can go through and replace them all manually, but a) there are a LOT of them and b) I then get messages that the lines are super long when I try to parse it.

Any ideas on this one? Should I replace the "\r" with "/r"?
The \ is a special character in XML, specifically it is used to close elements (tags) and you can't have it part of the element's name or in some cases as data in an element. However it is usually ok to have it inside of FG's data when that data belongs to certain formated text elements - which is where you should see them normally.

So you most likely don't need to change all those \r's (which yes are CRs). As a guess I'd think specific problem is you likely have some garbage characters in an element name or possibly as data in some element other than a formated text one. Basically all you need to do is go to the line number where the parser says there is a problem and fix only that one thing. From my experience a few weeks ago when I parsed a couple of modules I would guess you probably have a URL (web address) in place of a power icon. WotC's DDI data integrity is marginal and often does have mistakes or problems.

So what you need to do is run the parser again and copy and paste the error message, specifically the line number. The error is going to be right around that line number. It could be the line prior or the line after but it should be right around the line number the error gave you.

Once you know the line number you want to load the db.xml file into an editor and go to that line and look around for a problem. If you do not have an editor that reads XML files then I'd suggest you download the free Notepad++ (google it).

All you are looking for in the xml file is what is at that line number. You want to know what power/monster/item is messed up. You actually want to fix the problem in the text file the parser uses to build the XML file, not the actual XML file.

It might be hard for you to figure out the problem the first time you try to fix the error - if you run into problems then just ask.

lady2beetle
September 5th, 2010, 15:15
Thank you! I will most certainly keep asking questions! :D

I figured out that the problem was that somewhere the name of the powers weren't being given the </name> tag, so the system was taking the entire power entry as its name. I went into the first one (Fate of the Void) in the db.xml and coded it to match the other powers (whew!). But now when I go back to parse it, it just writes over the old db.xml! How do I get it to take my changes and keep going?

Edit: Also, THANK YOU for the guide you linked! I looked everywhere for a users guide but my googlefu failed me. I assumed you just had to be smart enough to figure it out for yourself. >.>

Edit2: Hmm... I've further deduced that <name> tag problem ONLY an issue with warlock pact boons. None of the others. Any idea why?

SniperDM
September 6th, 2010, 09:20
Thank you! I will most certainly keep asking questions! :D

I figured out that the problem was that somewhere the name of the powers weren't being given the </name> tag, so the system was taking the entire power entry as its name. I went into the first one (Fate of the Void) in the db.xml and coded it to match the other powers (whew!). But now when I go back to parse it, it just writes over the old db.xml! How do I get it to take my changes and keep going?

Edit: Also, THANK YOU for the guide you linked! I looked everywhere for a users guide but my googlefu failed me. I assumed you just had to be smart enough to figure it out for yourself. >.>

Edit2: Hmm... I've further deduced that <name> tag problem ONLY an issue with warlock pact boons. None of the others. Any idea why?

As a matter of fact, I ran into this problem myself. To solve it, open the powers.txt file from the scrape and find each of the warlock's pact boons (Misty Step, Fate of the Void, Hellish Rebuke) and replace the text at the top of each entry that says "Warlock Pact Boon" with "Warlock Feature". After that, just reparse and it should work.

I don't know exactly why it works that way -- the parser doesn't seem to know what to do with the Pact Boon tag, and these features were probably changed internally on WotC's side fairly recently, but this is a perfectly functional workaround for now.

lady2beetle
September 6th, 2010, 15:39
WHOOT! Thank you! I had managed to track down the post on packaging .xml documents as .mod files, but couldn't get it to work. Thank goodness I don't have to! *HUG*

zapoqx
September 7th, 2010, 04:41
Thanks for the answer I needed as well. Gotta love the community support.

Griogre
September 7th, 2010, 22:20
I suggest you keep a list of things you needed to change in the text file to make things parse right. While Tenian releases frequent updates to fix problems, WotC releases frequent errata. There is one due out soon so the Essentials and Core Rules are stay in sync. If you keep a list of the powers and changes you did then it will be very easy to re-scrape from the compendium to get the new errata and then just change the few things that don't parse.