Chad's Europa Universalis II Utilities
EU2 Lint: The EU2 Leader/Monarch/Event
Syntax Checker
*** NEW: Version 0.9.4 Released August 26, 2005 ***
[online demo]
[Version 0.9.4]
[older versions]
[ChangeLog]
[online demo - previous version
0.9.3]
Description
This program reads in any number of leader, monarch, or event files, and performs and number
of validation checks on each file. It has three main modes, which can be invoked individually in
separate steps, or all at the same time. These modes are:
- Leader - Check for correct syntax for each leader definition. Make sure the important fields -- ID, name, category, startdate, deathdate, rank, movement, fire, shock, and siege --
are all defined. Check the ID for an integer value from 0-200,000. Make sure the leader IDs are unique over all the files analyzed
- Monarch - Same as for Leaders, except the required items are ID, name, startdate, deathdate, DIP, ADM, and MIL. If Leader definitions
have been parsed, verify that leader and monarch IDs don't conflict.
- Event - In the simplest case, this does syntax checking on the events found in specified files.
For more rigorous checking, there are a few advanced options. If leaders and/or monarchs have been parsed (either in the
same run, or imported from the output of a previous run), then references to them in the event triggers and commands
will warn if the leader/monarch ID is undefined. If a pointer to the country.csv file is passed to the program,
it can read the country tags, and warn if an invalid one is being used. If a pointer to the text.csv file is passed,
any event name or description that looks like 'EVENT*' or 'ACTION*' will look in this file for a definition,
and give a warning if it is not found.
Included with the distribution is a CGI script, that can be run from within a web server to do online
event checking. A working demonstration of this can be seen at this link.
It can accept text up to about 512K of text as input, and gives output similar to the command line program, except for external references to the
leader/monarch/country.csv/text.csv files.
You are welcome to use this script to validate events of your own.
This is a basic perl program, so if Perl is already installed, you don't need anything else. Just
open a windows console (cmd.exe or command.com) to run it. The syntax is:
Or, if you are not running it from the current directory:
perl -I lint_directory lint_directory\lint.pl options
where the options are:
- -help
- Explains all the various command line options
- -version
- Print the current version of this script, and the parser version it is
using
- -check-range type
- Determines how much to complain if event values are out of reasonable
ranges. Type can be strict, loose, or none. Default is strict
- -check-year low:high
- Warns if any date is out of this year range. Default is 0:9999
- -nowarn-dup-ids
- Don't complain about duplicate IDs being used. Not fully tested
- -leaders file_or_directory [-leaders file_or_directory ...]
- File or directory to read leaders from. It will ignore any file which
doesn't match "leaders.TAG". If -countrycsv is specified, it will also
ignore any country which isn't defined in country.csv
- -monarchs file_or_directory [-monarchs file_or_directory ...]
- File(s) or directory(s) to read monarchs from. It will ignore any file
which doesn't match "monarchs.TAG". If -countrycsv is specified, it
will also ignore any country which isn't defined in country.csv
- -countrycsv path_to_country.csv
- Location of the country.csv file. If defined, it will read in country
tags, and use them to determine which leaders.* and monarchs.* to read
- -importleaders
- -importmonarchs
- Instead of getting leader/monarch IDs by parsing leaders.* or
monarchs.* files, import them from the text files that get created in
the lint_data directory from a previous parse. These two parameters are
used when you want to cross-references leader IDs with monarch and
event data, or to cross-reference both leaders and monarchs in event
data. It will speed up testing by avoiding a re-check of files that
have already been checked
- -importleaders filename [-importleaders filename ...]
- -importmonarchs filename [-importmonarchs filename ...]
- Same as above, but specify a specific filename, rather than the default
lint_data\leaders.dat and lint_data\monachs.dat files. Multiple files
can be specified.
- -datadir directory_name
- Use a different directory to store program output. If not specified,
all output will be written to the directory "lint_data" within the
current directory. The directory will be created if it does not exist.
- -events file_or_directory [-events file_or_directory ...]
- File(s) or directory(s) to read events from.
- -textcsv path_to_text.csv [-textcsv path_to_text.csv ...]
- If specified, the program will open a text.csv file, and make note of
any tag that looks like EVENT* or ACTION*. After this, when events are
analyzed, it will verify that any name or desc reference that looks
like EVENT* or ACTION* is actually defined in the text.csv file.
- -eventlist filename [-eventlist filename ...]
- Reads in a scenario include file (e.g., events.txt), and searches for
'event = "*"' patterns. It will then use all the files defined here as
the basis for which of the event files/directories specified above to
read or ignore; It will ignore any event file not defined in the list
file. If not specified, all event files will be included, and none will
be ignored.
- -eventlistfilter pattern [-eventlistfilter pattern ...]
- This is used in combination with the -eventlist directive. The event
files references in scenario include files usually include a partial
path name such as 'Db\Events\filename.txt' instead of 'filename.txt'.
If you specify pattern "Db\Events", then this will be stripped off. If
not specified, any directory names will be filtered, leaving just the
bare filename.
Hints
If you are running this against a directory with a lot of files in it, you can capture the output
from the command so that you don't need to watch it as it scrolls out of the console window. Just
add > output.txt to the end of the command, and it should save the output
into the specified file. I'm not sure about windows 98, but it will probably work.
Range Boundaries (as of version 0.9.2). (*) indicates warning only when check_range is strict
GPL*
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option)
any later version. For further information, see
http://www.gnu.org/licenses/licenses.html#GPL.
Send bugs and feature requests to chad_eu2@katica.org