So, here are the few examples I promised!
Assume that the base game doesn't exist here and only what is declared here is real.
we have the following things defined by our mod:
Civilizations:
CIVILIZATION_ENGLAND
CIVILIZATION_FRANCE
CIVILIZATION_SPAIN
CIVILIZATION_GERMANY
UnitClasses:
UNITCLASS_CROSSBOWMAN
UNITCLASS_TANK
UNITCLASS_MUSKETMAN
Units (With UnitClassType in brackets):
UNIT_LONGBOWMAN (UNITCLASS_CROSSBOWMAN)
UNIT_PANZER (UNITCLASS_TANK)
UNIT_TERCIO (UNITCLASS_PIKEMAN)
UNIT_MINUTEMAN (UNITCLASS_MUSKETMAN
Civilization_UnitClassOverrides (With UnitClassType, Unit in brackets):
CIVILIZATION_ENGLAND (UNITCLASS_CROSSBOWMAN, UNIT_LONGBOWMAN)
CIVILIZATION_FRANCE (UNITCLASS_MUSKETMAN, UNIT_MUSKETEER)
CIVILIZATION_SPAIN (UNITCLASS_PIKEMAN, UNIT_TERCIO)
CIVILIZATION_GERMANY (UNITCLASS_TANK, UNIT_PANZER)
CIVILIZATION_AMERICA (UNITCLASS_MUSKETMAN, UNIT_MUSKETEER)
so, if we load the mod into the program and don't create any excludes (yet) the program will tell us some interesting information
Code:
Missing Reference: Row with type UNIT_TERCIO in Units references UNITCLASS_PIKEMAN in tag UnitClassType, this object doesn't exist
Missing Reference: Entry with CivilizationType = CIVILIZATION_FRANCE in Civilization_UnitClassOverrides references UNIT_MUSKETEER in tag UnitType, this object doesn't exist
Missing Reference: Entry with CivilizationType = CIVILIZATION_SPAIN in Civilization_UnitClassOverrides references UNITCLASS_PIKEMAN in tag UnitClassType, this object doesn't exist
Missing Reference: Entry with CivilizationType = CIVILIZATION_AMERICA in Civilization_UnitClassOverrides references CIVILIZATION_AMERICA in tag CivilizationType, this object doesn't exist
So, it appears we might have made some mistakes!!! And checking back it is right, we didn't define UNITCLASS_PIKEMAN, UNIT_MUSKETEER or CIVILIZATION_AMERICA!!!
But, we already knew we hadn't made the UNIT_MUSKETEER yet, we just wanted to test everything else first (I know it isn't hard to ignore that error, but with text tags for example it could become very annoying to look at) so lets write an exclude to ignore that Row from parsing
Code:
Enter Commands
exclude <UNIT_MUSKETEER>;
end;
if we run the checks now it gives us this:
Code:
Missing Reference: Row with type UNIT_TERCIO in Units references UNITCLASS_PIKEMAN in tag UnitClassType, this object doesn't exist
Missing Reference: Entry with CivilizationType = CIVILIZATION_SPAIN in Civilization_UnitClassOverrides references UNITCLASS_PIKEMAN in tag UnitClassType, this object doesn't exist
Missing Reference: Entry with CivilizationType = CIVILIZATION_AMERICA in Civilization_UnitClassOverrides references CIVILIZATION_AMERICA in tag CivilizationType, this object doesn't exist
Perfect! But what if we wanted to ignore more general terms? Like we want to exclude any checks involving units from the program. This is where the script uses a specification called regex (Regular Expressions):
Code:
Enter Commands
exclude <UNIT.*>;
end;
Here we used the regex .* to mean exclude anything which matches UNIT with 1 or more characters added on the end. If we run the program now:
Code:
Missing Reference: Entry with CivilizationType = CIVILIZATION_AMERICA in Civilization_UnitClassOverrides references CIVILIZATION_AMERICA in tag CivilizationType, this object doesn't exist
everything to do with units is gone! so UNITCLASS_... matches as it is UNIT followed by stuff as does UNIT_MUSKETEER.
Using regex it is possible to create complex excludes for files and tags, but I won't go into that here!
So that is what the program does so far, when I get past the prototype I will be able to say more about it. But at least the errors are more meaningful, the scripting is optional too! The only thing you might notice it doesn't show you is the File the error is in, but this is because all the tags are loaded into memory so the File is irrelevant, just like in-game.