PDA

View Full Version : Formatted Text Error



Garethpr
April 17th, 2023, 16:02
Hi I frequently get this error while using the generate story feature
FGU is up to date - ruleset Morecore
[ERROR] FormattedText SetValue XML Error: An error occurred while parsing EntityName. Line 1, position 1408.
always line 1. The position where the error is said to occur changes every time and this is happening for about 60% of generations.
I don't know which file this error is occuring in - I'm assuming its FGU base and I don't have access to the code.
Can anyone help?
Thanks in advance. G

LordEntrails
April 17th, 2023, 16:08
MOD: I've moved this to a new thread and in the MoreCore sub-forum. Please post bugs and issues in new threads unless your issue is exactly the same as the previous thread.

Does this happen with no extensions enabled? Can you please post the log via? (See link in my signature for more help on how to do that.)

Garethpr
April 17th, 2023, 18:07
I couldn't see a way to make a new thread - also that was the only thing that came up in the search for formatted text error. yes there are extensions enabled is there a file that I can just print out or do i have to type them all out by hand?

Zacchaeus
April 17th, 2023, 18:15
I couldn't see a way to make a new thread - also that was the only thing that came up in the search for formatted text error. yes there are extensions enabled is there a file that I can just print out or do i have to type them all out by hand?

You can compile log files by going into settings and go into the troubleshooting tab; and hit the button. But first test in a new campaign without extensions to see if you can replicate the error there. If you can't then it is likely an extension that is causing the issue. Enable them one at a time until you can replicate the error and the last extension you enabled will be the problem.

Garethpr
April 17th, 2023, 18:41
Here's the logs It'll take some time to find out if any other mod is effecting things as it only happens about 60% of the time.

G

Moon Wizard
April 17th, 2023, 19:03
I'll need to get a copy of the zipped up campaign file along with the name of any Story Templates that generates that error.

Regards,
JPG

Garethpr
April 17th, 2023, 19:41
I'm about a 1/4 of the way removing 1 mod at a time.
These 4 character generators only the name tables are different 2 random and 2 pregen christian nasmes. same effect both tables.

Garethpr
April 17th, 2023, 20:09
all mods checked no change and all removed same problem. 43% error rate.

G

Moon Wizard
April 17th, 2023, 20:59
As I mentioned above, you'll need to post the campaign folder zipped up, with notes to which story templates are failing.

The original story templates behavior was written by @JimSocks; so we'll have to send the data to him to see what is happening.

Regards,
JPG

damned
April 18th, 2023, 00:28
Hi I frequently get this error while using the generate story feature
FGU is up to date - ruleset Morecore
[ERROR] FormattedText SetValue XML Error: An error occurred while parsing EntityName. Line 1, position 1408.
always line 1. The position where the error is said to occur changes every time and this is happening for about 60% of generations.
I don't know which file this error is occuring in - I'm assuming its FGU base and I don't have access to the code.
Can anyone help?
Thanks in advance. G

Hey Garethpr I dont make any changes to Story or Story Templates directly but sometimes I have used a duplicate template name somewhere that messes things up. Can you share the campaigns db.xml file and steps to reproduce? Ill test it in CoreRPG so we can work out whether its my issue or CoreRPG.

Garethpr
April 18th, 2023, 13:00
sure here's the db file.

I'm not sure what steps you want using the story template I posted above press generate. It works or it doesn't re_generate until it does work.
When it fails it comes up with a blank generation and the error pops up in the console with a line 1 of whatever file it is because it doesn't say but a different place in the line each time with numbers that are bigger than any code I would use.

G

damned
April 18th, 2023, 14:48
Im pretty sure its because Table [Name Middle] doesnt have a 317 entry
However there is likely to be a few more errors littered thru that large number of tables/entries.
You might also find that limiting tables to 100 entries will give you better performance

Garethpr
April 18th, 2023, 16:10
Ok i've checked and amended that thanks - but that doesn't explain why it fails so often. 40% of the time it lands on 1 choice of 332. Not very likely. I did however see somthing in Name where it looks like there is -- but in fact that is an empty space instead of "-" so i've fixed that too. Also the same error occuirs using the other name table (Christian) which is different. line 1 - position 825 and 930 and in my other campaig having fixed the same errors there line 1 704 and 891.

damned
April 18th, 2023, 16:20
Yes I suspect there are other issues. Unfortunately I cant see a way to get any clues for the issues without running every table dozens of times until an error occurs. Fix and repeat. You may have to try and add some debug into the Templates code which maybe non trivial to access and understand.

Garethpr
April 18th, 2023, 16:38
So also fixed the no 317 in name begin. Now I'm getting this error.
[ERROR] FormattedText SetValue XML Error: ')' is an unexpected token. The expected token is ';'. Line 1, position 704. the error still happening across both campaigns and both types of name generation.

damned
April 18th, 2023, 16:41
Try making a simple template that only uses [Name] and test it out. If it still errors there are still more errors in the name tables. Roll the tables directly until you get an error. Tedious. That is quite an amazing setup you have put together.

Garethpr
April 18th, 2023, 16:55
That is what I have been doing and the error is still this line 1 of what code I can't go look at it because it doesn't tell me where to look. Line 1 of db.xml doesn't have more than 38 positions. Also the same error occurs when using the "Christain" name generator and that is different tables with whole words rather than random syllabuls.

You see here attached the "Name" alone isn't causing the error.

G

Garethpr
April 18th, 2023, 17:07
Here's the other test. Same result.

G

Trenloe
April 18th, 2023, 17:12
The error is being caused when the code tries to set the value of the formatted text control (the control that displays the text in the story entry) using the formatted text contrl setValue API command: https://fantasygroundsunity.atlassian.net/wiki/spaces/FGCP/pages/996645025/formattedtextcontrol#setValue

The API command checks that the value being set is correct XML - in the case of these errors, the code is encountering invalid XML in the data. At this point it's just in a LIUA variable, so the only way to access it is by putting debug code in the FG ruleset in order to try to track down what the error is being caused by.

XML has some requirements for markup - and the error is being caused because something in the generated text is breaking the XML markup. This will be because reserved characters are being used within the text - see this page for the list of reserved characters: https://learn.microsoft.com/en-us/visualstudio/msbuild/how-to-use-reserved-xml-characters-in-project-files?view=vs-2022

Avoid using these characters in the table data that are used in the story templates.

Trenloe
April 18th, 2023, 17:26
Continuing my previous post - I put some debug in a test CoreRPG ruleset - some errors were caused by the names of some linked records - like those with an ampersand in the name; for example: the "Note pad & stylus" item entry in one of the tables.

Because this is being inserted as a link, with the name embedded in the resulting XML, the & in the name causes the XML to break.

Ideally the FG code should do some replacements - but the problem is that by the time the final XML has been generated, there could well be a bunch of valid XML that has correctly escaped characters using the code that being with & - so the replacement code would have to be written so as not to replace valid XML escape characters, or other code replacements that use &... As this appears to be an issue that doesn't come up that much (or, at least, isn't reported much) that may not happen for a while. So you'll be stuck with having to properly escape the data - or don't use the reserved characters.

Trenloe
April 18th, 2023, 17:35
Here's a few examples of text that proves and issue, all because of the & :

Survival Instincts 2, in an environment that you were bought up in add +1 armour & evade.
Scientists & Academics only.
melee attack on smaller beings +2 wounds & cause weakness

Garethpr
April 18th, 2023, 18:16
Ok checking for that I know there sre some in one campaign.

Garethpr
April 18th, 2023, 20:29
Been through every table - removed a handfull of & and many apostrophies but none were 'in code' only description. Reloaded and we're back to the parsing entityName, Line 1. position 969.

Trenloe
April 18th, 2023, 20:45
Not sure what you mean by "in code", but anyway... You're always going to get the error at line 1 and a position within that line - because what's constructed from the story template is combined into one big single line of text before being loaded to the story entry - it's adding to the entry where the XML is checked. So there's still something within all of those tables used to generate the story that's causing invalid XML.

Trenloe
April 18th, 2023, 21:01
Download the attached extension - it has some debug code in it that will help to identify what causes an error. Install this .ext file in your <FG app data>\extensions directory and enable the "Story Template Debug" (restart FG if you can't see it in the extensions list).

Then follow the instructions in this video: https://www.dropbox.com/s/4cjeam4uyp1ojb9/Story%20Template%20Debug.mp4?dl=0

Garethpr
April 18th, 2023, 21:01
Ok I'll do a line by line check

I think we've cracked it no more & i'd still missed two in sub tables. I'll try the debug on the other campaign. Ty.

Trenloe
April 18th, 2023, 21:02
Ok I'll do a line by line check
See my last post above - posted at the same time as you so you may have missed it.