• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.
What I meant is that the best way to find something like a missing bracket is to successively divide the file in half until you isolate the error. Anyway, I'll take a look.
 
Someone asked me to upload my updated validator files for the 1.3 beta patch, so here they are: http://www.mediafire.com/?jf8ndnd6gwzf426
The link has been updated to a newer version that correctly identifies wrong coastal provinces / sea adjacencies. Download again if this line wasn't here when you first downloaded the update. Please also see the note about random = no at the end of this post.

You'll need v0.8.9b from the first page of this thread. Extract the update to the folder \extension\data\. If done correctly, you'll find a new entry in the list of games called "For the Glory 1.3beta". Be sure to select Debug and Strict in your options.

Some changes are not related to 1.3, the most important of these are the following:



IDs may not begin with zero.
The validator doesn't recognize 1 and 0001 as the same number, so you'll need to remove those leading zeroes yourself if you want to find all duplicate IDs. You can easily do this with Notepad++ and a little regex magic. First, you need to open all files in \db\leaders\ and \db\monarchs\ (select all, right click, edit with n++) as well as all your event files and scenario files (in other words, all files that contain IDs) and do a regex replace (CTRL+H, tick "regular expression" in the lower left corner, leave the "replace with" field empty, then click "replace all in all opened documents") for the following search string:
Code:
\Wid\s*=\s*\K0+
Don't panic if your PC seems to freeze, this may take a little while. When you see a message that all occurences have been replaced, select File -> Save All, or press CTRL+SHIFT+S.



Every monarch/leader ID must be unique.
FtG doesn't care if an ID in a scenario file's monarchtable/leadertable is already used in the country's monarch/leader file. However, the validator can't make that distinction, so a monarch/leader ID that's used in a scenario may not be used anywhere else, including other scenarios. This is somewhat annoying, but it's the only way to make sure there are no duplicate IDs. Since type 6 IDs may not have more than 6 digits, I found it very helpful to restrict IDs in monarch/leader files to 5 digits and give all IDs in scenario files a leading 6th digit that is the same for all IDs in that scenario file.


How to find 6-digit IDs in monarch/leader files:
Open all files in \db\leaders\ and \db\monarchs\ and do a search (CTRL+F, click "find all in all opened documents") for the following regex search string:
Code:
type\s*=\s*6\s+id\s*=\s*\K\d{6}
You can either manually replace all results with shorter unique IDs or check which digits these IDs begin with and use other leading digits for your scenario files.


How to pad IDs to 6 digits:
Open your scenario file and replace the following regex search strings with 0, in this order:
Code:
type\s*=\s*6\s+id\s*=\s*\K(?=\d\D)
type\s*=\s*6\s+id\s*=\s*\K(?=\d{2}\D)
type\s*=\s*6\s+id\s*=\s*\K(?=\d{3}\D)
type\s*=\s*6\s+id\s*=\s*\K(?=\d{4}\D)
Lastly, replace the following search string with a non-zero digit of your choice:
Code:
type\s*=\s*6\s+id\s*=\s*\K(?=d{5}\D)
If you don't want to use different digits for each scenario you can validate them one at a time and move the other scenarios to a separate folder.



FtG months have 30 days, starting at index 0.
You'd think modders knew this, but the huge amount of day values larger than 29 tells a different story. To replace all those values, open all your text files that contain dates (events, monarchs/leaders, revolt.txt, scenario files, etc) and replace the following search string with 29:
Code:
\Wday\s*=\s*\K3\d



Events may not have "random/persistent/global = no" anymore.
This is due to some checks that won't work otherwise. Since "no" is the default, you can simply delete those lines in all your event files. Replace the following search string with nothing:
Code:
^\s*random\s*=\s*no\s*\R
If you still get errors it means there are some inline occurences left, in which case you also need to replace the following regex with nothing:
Code:
random\s*=\s*no



Have fun validating.
 
Last edited:
Thanks for the update, Andrei. Where those 30-daymonths a critical problem? I also get this message from the validator:

--- Error 1 of 1 ---
Type Mismatch Error
At <mod>\db\events\major_byz.txt [event[32]\action_b\command[2]\which] (1410, 30):
"-2" is not a valid LandProvinceCoastal, random, -1, last_random, -3, random_distinct, -4, random_not_capital, -5, random_distinct_not_capital, or -8.

So which value replaces the -2?
 
Days aren't critical, no.

What command is it that gives you the error? Apparently it's one that targets only coastal provinces, so you shouldn't use -2 or capital. If you know the province ID of the capital (seems to be the case with BYZ) you should use it, otherwise you shouldn't be targeting a capital that might not be a coastal province.
 
Last edited:
many thanks for this great work
 
Andrei, after your update the validator gives me like 11k errors. Before the update the number was 0.

Now it keeps mentioning things like random = no (expected yes) in "normal" events. I guess this is not WaD.
 
Ah yes, that was one of the other changes I made. The problem is that every event needs at least one of
Code:
random = yes
persistent = yes
global = yes
country = TAG
province = ID
or it won't trigger. Now in the validator, I can easily check for random, persistent, etc., however if "random = no" is allowed this doesn't work because I can only check for the left side. Since random = no is the default, you can simply remove all those lines, which is what you need to do if you want to validate your event files. This takes a few seconds with Notepad++, here's the regex:
Code:
^\s*random\s*=\s*no\s*\R
Replace with nothing in all event files. If you still get errors it means there are some inline occurences left, in which case you also need to replace the following regex with nothing:
Code:
random\s*=\s*no

Sorry for all the work that comes with these validator updates, but I make them primarily for personal use and I prefer being able to find rare non-critical errors over a bit of user-friendliness.
 
New version here, delete old "Ftg13" folder first if you have one of my other updates installed.

Some fixes and much better usability. Strictness levels finally implemented.
 
I'm getting this error when I run the validator. I tried both v0.8 and v0.8.9b.

Code:
Beginning initialization...


ec) EXCEPTION CONTEXT


dec) DEFAULT EXCEPTION CONTEXT






ERROR
System.ComponentModel.Composition.ImportCardinalityMismatchException: No valid exports were found that match the constraint '((exportDefinition.ContractName == "SelfValidationCall") AndAlso (exportDefinition.Metadata.ContainsKey("ExportTypeIdentity") AndAlso "System.Void(Audax.Clausewitz.Validator.Context,Hydrus.Scripting.ElementNode)".Equals(exportDefinition.Metadata.get_Item("ExportTypeIdentity"))))', invalid exports may have been rejected.
   at System.ComponentModel.Composition.Hosting.ExportProvider.GetExports(ImportDefinition definition, AtomicComposition atomicComposition)
   at System.ComponentModel.Composition.Hosting.ExportProvider.GetExportCore[T](String contractName)
   at Audax.Clausewitz.Validator.Common.Validate(Context c, ElementNode module)
   at Audax.Clausewitz.Validator.Common.ProcessModuleBody(Context c, ElementNode module, Scope scope)
   at Audax.Clausewitz.Validator.Module..ctor(Context c, Scope scope)
   at Audax.Clausewitz.Validator.Module.Create(Context c, Scope scope)
   at Audax.Clausewitz.Validator.GameValidator..ctor(CFilePath path)
   at Audax.Clausewitz.Validator.ValidationManager.ParseGameFiles()
Since there were problems with initial loading, validation cannot continue.
 
Update for the latest beta:
http://www.mediafire.com/download/7li7tbpz65z50ex/ftgvalidatorupdate13b4.zip
As usual, drop the folder ftg13 in data.

About the strictness levels...
  • Critical errors is what you should be selecting when you use the validator to find the cause for a CTD.
  • All errors is what you should be selecting when you validate a mod and are looking for general errors. This section should ideally be empty, or only list items that you deliberately do not want to "fix" at this point (e.g. 'breakdynastic' commands).
  • Strict may list a lot of things that aren't necessarily errors, but are often caused by sloppiness, e.g. values outside of common ranges, events missing certain entries, or artifacts from EU2 that are being kept for compatibility reasons.
The validator still has problems with monarch/leader IDs in savegames; unfortunately this is a limitation I cannot work around. In general, you should only ever have one scenario in the scenario folder (move the others elsewhere) and the IDs shouldn't overlap with those in the /db/monarchs/ and /db/leaders/ folders (which has implications for events and unions) or you can't validate scenarios. Also, the validator gets confused about any kind of IDs with leading zeroes, so those should be avoided.

At the "strict" level, the event keys "random", "persistent" and "global" may not have the value "no". If you have any such events, you can simply remove those keys which has the same effect. See above for a regex to do this.

That's it. Everything should work now.



The validator tells me that "countryname" is not al valid type when I try to change the name by event.
Maybe a typo somewhere? Or perhaps I already fixed it and forgot about it. Either way, the command is definitely recognized by the latest version.

I'm getting this error when I run the validator. I tried both v0.8 and v0.8.9b.
The correct version is v0.8.9b. The error seems to be an initialization error, so this happens before you even try to validate anything, right? Nothing much I can do about that; you can try to reinstall it, run it in compatibility mode and with admin rights, reinstall .NET framework 4.0, etc.
 
The correct version is v0.8.9b. The error seems to be an initialization error, so this happens before you even try to validate anything, right? Nothing much I can do about that; you can try to reinstall it, run it in compatibility mode and with admin rights, reinstall .NET framework 4.0, etc.
The validator works now that I have installed a different Windows version.

Thanks for the latest update!
 
Glad to hear it works now.

If anyone has problems with the validator or there's a reason to update it, and I haven't been around for a while or don't respond within a day or two, please send me a PM and I'll get back to you asap.
 
Update for the latest beta (1 December):
http://www.mediafire.com/download/y31fqs3y5voy137/ftgvalidatorupdate13b5.zip

As usual, drop the folder ftg13 in data.

About the strictness levels...
  • Critical errors is what you should be selecting when you use the validator to find the cause for a CTD.
  • All errors is what you should be selecting when you validate a mod and are looking for general errors. This section should ideally be empty, or only list items that you deliberately do not want to "fix" at this point (e.g. 'breakdynastic' commands).
  • Strict may list a lot of things that aren't necessarily errors, but are often caused by sloppiness, e.g. values outside of common ranges, events missing certain entries, or artifacts from EU2 that are being kept for compatibility reasons.
The validator still has problems with monarch/leader IDs in savegames; unfortunately this is a limitation I cannot work around. In general, you should only ever have one scenario in the scenario folder (move the others elsewhere) and the IDs shouldn't overlap with those in the /db/monarchs/ and /db/leaders/ folders (which has implications for events and unions) or you can't validate scenarios. Also, the validator gets confused about any kind of IDs with leading zeroes, so those should be avoided.

At the "strict" level, the event keys "random", "persistent" and "global" may not have the value "no". If you have any such events, you can simply remove those keys which has the same effect. See above for a regex to do this.

Also, instead simply being ignored, all AI files in the AI folder are now properly validated.

When enabling AI validation, make sure to tick the "Hide Vanilla Errors" checkbox, and remove any files that aren't AI files from the AI folder.
 
Just a question.

Do you plan to improve the validator in order to check the files about religion ? (global_flags.txt, religions.txt and religions_special.txt)

In all case, this tool is very useful. Thanks for working about.
 
Oh wow, I had no idea there was no validation for religion files. I'll get to it in the next few days, probably.

Groups and subgroups aren't hardcoded, are they? So they're defined by adding them as religion parameters?
 
Groups and subgroups aren't hardcoded, are they? So they're defined by adding them as religion parameters?

As i can know, they aren't. All seems parametrable