CSlint How-To

Post new scenarios and mods here to share with other gamers.

Moderator: Campaign Series Matrix Edition Development Group

User avatar
Crossroads
Posts: 17498
Joined: Sun Jul 05, 2009 8:57 am

CSlint How-To

Post by Crossroads »

This is a how-to reference for installing and using CSlint utilities under Windows Subsystem for Linux (WSL). Any questions, errata, please let us know!




How-To: CSlint in Windows 10 or higher

The purpose of this thread is to describe how-to
  • Install the "Windows Subsystem for Linux", or "WSL", in Windows 10 or higher
  • Install, setup, and use the CSlint quality assurance tools in WSL
  • Install Lua for being able to QA your Lua scripts as well in WSL
  • Run any other helpful Bash shell scripts there

To get started, here's the Microsoft Windows Subsystem for Linux Documentation home page. Have a look so that you get an overall idea for what WSL is, if you're not already familiar with it.

Now that Windows 10 comes with a full blown Linux subsystem, there is no longer a mandatory reason to install Cygwin on Windows systems. Do note that Berto developed CSlint under Cygwin, so while I for one am solely using WSL to run CSlint nowadays, it is not necessary 100% compliant with Cygwin.

Any questions or comments please post here [:)]



What is CSlint?
ORIGINAL: berto

Akin to the well-known C programming language utility lint. ("Lint: A Unix C language processor which carries out more thorough checks on the code than is usual with C compilers. Lint is named after the bits of fluff it supposedly picks from programs.")

Similarly, CSlint is a toolkit of programs designed to discover and report bugs, problems, glitches, anomalies in the Campaign Series game data files.




Table of Contents


Useful links
Visit us at: Campaign Series Legion
---
CS: Vietnam 1948-1967 < Available now
CS: Middle East 1948-1985 2.0 < 3.0 In the works
User avatar
Crossroads
Posts: 17498
Joined: Sun Jul 05, 2009 8:57 am

RE: CSlint How-To

Post by Crossroads »

Installing Windows Subsystem for Linux on your W10 or higher

First, you must have an up-to-date Windows 10 or higher to do this. Anything older, for instance Windows 7 or Windows 8, you need to install Cygwin instead to be able to run CSlint scripts and Bash shell commands on your Windows rig.

That said:

STEP 1 - To install the subsystem, follow the steps described in this page: Install on Windows.
  • Use the install method Windows 10 Fall Creators Update and later: Install from the Microsoft Store as specified there (the first option)
  • Select Ubuntu as your Linux distribution on your computer ( I need to talk with Berto if this is still important, or if you'd just choose your favourite distro instead)
ubuntuwsl.jpg
ubuntuwsl.jpg (53.4 KiB) Viewed 2832 times



STEP 2 - Once you've completed those steps and installed Ubuntu per above, initialize your new installation as described here.
  • keep your username and password very simple, as you do not (!) want to forget them later on.


Image




STEP 3 - update the Ubuntu package with latest updates

At this stage, update the Ubuntu package with latest updates by typing in the following command:


$ sudo apt update && sudo apt upgrade
ORIGINAL: berto

That is the procedure for doing a "WSL Update". This is similar to a Windows Update, but unlike Windows Update, any WSL (Linux) update is not automatic; you must initiate it manually. The Linux maintainers update Linux bits and pieces constantly. For security and other reasons, it is important that you issue the above command regularly, once per week or at minimum once per month, say.

After your initial WSL install, your new install will be substantially out of date. When you issue the above command, the "package list" will be updated. You will then be prompted (type 'y' for "yes") to do the actual upgrades. (Somewhere along the way, you might be prompted for a preferred "character encoding". If so, just select the default UTF-8. On one of my Ubuntu WSL installs, I was prompted for this. On the other, I was not. YMMV.)

(In the above command, 'sudo' -- "super user do [something]" -- is the wrapper command to elevate your privileges to "root" or "super user" status. "super user", aka "root", is the equivalent of Windows' Administrator. You will need to enter your user password when prompted for it by sudo. You are asked for your user password at the end of the WSL install. You do remember your WSL user password, right? [:)])
Visit us at: Campaign Series Legion
---
CS: Vietnam 1948-1967 < Available now
CS: Middle East 1948-1985 2.0 < 3.0 In the works
User avatar
Crossroads
Posts: 17498
Joined: Sun Jul 05, 2009 8:57 am

RE: CSlint How-To

Post by Crossroads »

Install the latest CSlint utily package to your WSL home.

  • As of now, the latest package will always be included with all games, in their /Tools/CSlint folder

STEP 1 - Configure your folder structure to CSlint environment settings, available in a file called cslint.conf.

To do so:
  • Locate and open cslint.conf at your game's \Tools\CSlint folder.
  • Open it up with Notepad, Notepad++, jEdit, ..., and edit it as follows


Note the syntax: your C-drive is /mnt/c your D-drive is /mnt/d and so on. Also, UPPER and lower cases MATTER here! Be careful!

The folders you need to specify are:
  • cslintroot - the folder where you have your CSlint package. We will soon have it at our WSL home directory. Simply: "~/CSlint"
  • gameroot - the base folder for your games. My install location for all my Matrix Games is C:\Matrix Games. Your path may differ from this.

  • vndir - CS Vietnam location.
  • medir - CS Middle East location but commented out! This is what you'd add once Middle East 3.0 with full CS Event Engine Lua implementation becomes available.
  • Note the commented-out rows as those begin with the hash symbol #

Here's mine, and this is the default cslint.conf tempalte on the Tools\CSlint folder as well as of 1.01 UPDATE:
# cslint.conf -- default CSlint configurations

# for the following configs, may be any of:
#
# yes|YES|true|TRUE|on|ON
# no|NO|false|FALSE|off|OFF
#
# omitting any config (perhaps by commenting out) defaults its setting to 'no'

show_notice no
show_warning no
show_error yes
show_files yes
show_linenos yes
test no
debug no

# for the following configs, set the appropriate directory (folder) path
# cslintroot & gameroot are required

cslintroot "~/CSlint"

gameroot "/mnt/c/Matrix Games/"

# Change the following configs as needed

vndir "Campaign Series Vietnam"

# medir "Campaign Series Middle East"




STEP 2 - Copy the CSlint package to your WSL home directory

Be careful here, and copy the following commands exactly as they appear!
  • Fire up your new Bash Shell, and one by one, run the commands exactly as they appear below.
  • Only alter your game folder location, if it differs from mine (the fourth line, where you first cd there)
  • You might want to copy them from here and paste them to Bash Shell

cp -p .profile .profile.orig

echo "" >> .profile

echo "export PERL5LIB=~/CSlint" >> .profile

cd "/mnt/c/Matrix Games/Campaign Series Vietnam/Tools"

rsync -vap CSlint ~


What you should now see is a listing of CSlint files copied to your ~/CSlint folder.

For further information for each command, see e.g. Ubuntu command listing.



STEP 3 - Test your new CSlint install

Finally, let us quickly test our CSlint intall by running one of the provided utilities.

First, cd to your new CSlint directory, right under your WSL home directory which is marked ~

Then, run say Orders-of-Battle reporting tool csoobrpt.pl with g -vn -h parameters (game = Vietnam, help).
cslint_rsync.jpg
cslint_rsync.jpg (238.98 KiB) Viewed 2832 times

I did this in above screenshot, you should get a similar result under your new install.


Visit us at: Campaign Series Legion
---
CS: Vietnam 1948-1967 < Available now
CS: Middle East 1948-1985 2.0 < 3.0 In the works
User avatar
Crossroads
Posts: 17498
Joined: Sun Jul 05, 2009 8:57 am

RE: CSlint How-To

Post by Crossroads »

Add Lua to your WSL install


Nicking Berto's internal post for this one:




Everybody, please do the following.

Image

You check for the existence of the lua & luac EXEs in your WSL install with



$ which lua luac
[nil]



Most likely, you will get no output, indicating that indeed they are not installed.

You effect the install via



$ sudo apt install lua5.2
...



The above will prompt you to enter your password.

After installation, you can check for successful install by



$ lua -v
Lua 5.2.4 Copyright (C) 1994-2015 Lua.org, PUC-Rio



In fact, the game engine EXE uses the more recent 5.3.4, but for our purposes, the discrepancy shouldn't matter.

With luac (also lua etc.) installed on your system, you can now do direct .lua file syntax checks by, for example



$ luac -p "$VN"/scenarios/VN_510327_Mao_Khe_H.lua
[nil]



If there is no output, there are no issues; the file syntax checks cleanly.

Since csluachk.pl invokes luac from within, you are now fully set up for csluachk.pl operation also.
Visit us at: Campaign Series Legion
---
CS: Vietnam 1948-1967 < Available now
CS: Middle East 1948-1985 2.0 < 3.0 In the works
User avatar
Crossroads
Posts: 17498
Joined: Sun Jul 05, 2009 8:57 am

RE: CSlint How-To

Post by Crossroads »

How to use CSlint tools


Here is an introductory guideline to using the utilities:


CSlint utilities included with Vietnam 1.00 [and following]

Visit us at: Campaign Series Legion
---
CS: Vietnam 1948-1967 < Available now
CS: Middle East 1948-1985 2.0 < 3.0 In the works
User avatar
Crossroads
Posts: 17498
Joined: Sun Jul 05, 2009 8:57 am

RE: CSlint How-To

Post by Crossroads »

Known anomalies when running CSlint under WSL

ORIGINAL: Crossroads

Now that Windows 10 comes with a full blown Linux subsystem, there is no longer a mandatory reason to install Cygwin on our systems. Do note that Berto developed CSlint under Cygwin, so while I for one am solely using WSL to run CSlint nowadays, it is not necessary 100% compliant with Cygwin.

KNOWN ANOMALIES




csmklua.pl
  • Recommended parameters: Use -a Abbreviate -p Prune -b Blocks parameters for Lua file genereation.
  • Error: under WSL when creating those ever importan Lua templates for your new scenario: curly brackets thrown an error and prevent the Lua file from being generated.
  • Solution: find and replace curly brackets in ORG file (typically aircraft ordnance descriptions) and replace with something else for duration of running csmklua.pl

petrin@elvis-v:~/CSlint$ ./csmklua.pl -g vn -h

Usage: csmklua.pl [-h|-help] [{+|-}G|-debug] [-a[bbreviate]] [-p[rune]] [-r[everse]] [-b[locks]] -g[ame] {me|vn|cw|ef|wf|pf} -f <scenario file> -o <lua file>

petrin@elvis-v:~/CSlint$ ./csmklua.pl -g vn -a -p -b -f VN_651117_LZ_Albany.scn -o VN_651117_LZ_Albany_TEST.lua

Unescaped left brace in regex is illegal here in regex; marked by <-- HERE in m/<([pcbrdgka])>Douglas A-1 Skyraider { <-- HERE Guns} 188</ at ./csmklua.pl line 1093, <CSLINT> line 185.


For some reason, the curly brackets are an issue. To run csmklua.pl in WSL, you need to go the scenario file, and for duration of csmklua, replace them with something else.

LZ_Albany ORG file:
P105014 188 6 Douglas A-1 Skyraider {Guns}
P105014 189 6 Douglas A-1 Skyraider {Guns}
P105014 190 6 Douglas A-1 Skyraider {Guns}
P105062 191 6 Douglas A-1 Skyraider {Rockets}
P105062 192 6 Douglas A-1 Skyraider {Rockets}
P105062 193 6 Douglas A-1 Skyraider {Rockets}
P105062 194 6 Douglas A-1 Skyraider {Rockets}
P105063 195 6 Douglas A-1 Skyraider {Bombs}
P105063 196 6 Douglas A-1 Skyraider {Bombs}
P105063 197 6 Douglas A-1 Skyraider {Bombs}
P105063 198 6 Douglas A-1 Skyraider {Bombs}
P105064 199 6 Douglas A-1 Skyraider {Napalm}
P105064 200 6 Douglas A-1 Skyraider {Napalm}

For instance:
P105014 188 6 Douglas A-1 Skyraider ---Guns---
P105014 189 6 Douglas A-1 Skyraider ---Guns---
P105014 190 6 Douglas A-1 Skyraider ---Guns---
P105062 191 6 Douglas A-1 Skyraider ---Rockets---
P105062 192 6 Douglas A-1 Skyraider ---Rockets---
P105062 193 6 Douglas A-1 Skyraider ---Rockets---
P105062 194 6 Douglas A-1 Skyraider ---Rockets---
P105063 195 6 Douglas A-1 Skyraider ---Bombs---
P105063 196 6 Douglas A-1 Skyraider ---Bombs---
P105063 197 6 Douglas A-1 Skyraider ---Bombs---
P105063 198 6 Douglas A-1 Skyraider ---Bombs---
P105064 199 6 Douglas A-1 Skyraider ---Napalm---
P105064 200 6 Douglas A-1 Skyraider ---Napalm---

Save, run csmklua.pl, undo changes, save again to original.

Note there is no need to do anything in the Lua file generated, especially if using the -a Abbreviate parameter as recommended to do.
Visit us at: Campaign Series Legion
---
CS: Vietnam 1948-1967 < Available now
CS: Middle East 1948-1985 2.0 < 3.0 In the works
User avatar
Crossroads
Posts: 17498
Joined: Sun Jul 05, 2009 8:57 am

Re: CSlint How-To

Post by Crossroads »

edited to comply with new forum html tags. A few images lost, though :(
Visit us at: Campaign Series Legion
---
CS: Vietnam 1948-1967 < Available now
CS: Middle East 1948-1985 2.0 < 3.0 In the works
User avatar
berto
Posts: 21461
Joined: Wed Mar 13, 2002 1:15 am
Location: metro Chicago, Illinois, USA
Contact:

Re: CSlint How-To

Post by berto »

csoobrpt.pl


csoobrpt.pl is a Perl script (program) to report the CS OOBs.

[NOTE: In my examples, I will be using Cygwin Linux. If you are using WSL Linux, your display will be somewhat different. But the essentials will be the same.]

Start by displaying the program help:



rober@Rob10rto ~/cslint
$ ./csoobrpt.pl -h

Usage: csoobrpt.pl [-h|-help] [{+|-}i|{+|-}insensitive] [{+|-}G|-debug] -g[ame] {me|vn|cw|ef|wf|pf} [{+|-}F|{+|-}show_files] [{+|-}N|{+|-}show_linenos] [-s<char>|-separator<char>] [-m "<string>"|-match "<string>"] [<parameters list>|-ALL]

parameters list:
-1 or -id
-2 or -strength
-3 or -assault
-4 or -defend
-5 or -firingcost
-6 or -loadingcost
-7 or -unloadingcost
-8 or -speed
-9 or -xcspeed
-10 or -weight
-11 or -pressure
-12 or -concealment
-13 or -movesound
-14 or -firesound
-15 or -countercell2d
-16 or -basecell3d
-17 or -animate
-18 or -type1d (NATO symbol)
-19 or -type2d (unit icon)
-20 or -bitmap3d
-21 or -points
-22 or -moveflags
-23 or -carryflags
-24 or -fireflags
-25 or -otherflags
-26 or -moreflags
-27 or -morefireflags
-28 or -startyear
-29 or -startmonth
-30 or -stopyear
-31 or -stopmonth
-32 or -frontmod
-33 or -sidemod
-34 or -rearmod
-35 or -name
-36 or -short
-37 or -nick



For now, just ignore the '[{+|-}i|{+|-}insensitive] [{+|-}G|-debug]' and focus on the rest.

Try this command:



rober@Rob10rto ~/cslint
$ ./csoobrpt.pl -g vn +F +N -s/ -m "huey" -id -carryflags -name -short -nick
Platoon10.oob:603: P106514 32 /UH-1B Huey/ /UH-1B Huey/
Platoon10.oob:604: P106515 32 /UH-1B Huey/ /UH-1B Huey/
Platoon10.oob:605: P106516 32 /UH-1B Huey/ /UH-1B Huey/
Platoon10.oob:610: P106521 8 /UH-1D Huey/ /UH-1D Huey/
Platoon10.oob:611: P106522 8 /UH-1D Huey/ /UH-1D Huey/
Platoon10.oob:612: P106523 8 /UH-1D Huey/ /UH-1D Huey/
Platoon10.oob:638: P106549 0 /AH-1G Early Cobra(2L2H)/ /AH-1G(2L2H)/ /HueyCobra/
Platoon10.oob:651: P106562 16 /UH-1D Huey Recon/ /UH-1D Huey Recon/
Platoon10.oob:1182: P106657 32 /UH-1B Huey/ /UH-1B Huey/ /- CAVALRY/
Platoon10.oob:1183: P106658 32 /UH-1B Huey/ /UH-1B Huey/ /- CAVALRY/
Platoon10.oob:1184: P106659 32 /UH-1B Huey/ /UH-1B Huey/ /- CAVALRY/
Platoon10.oob:1189: P106664 8 /UH-1D Huey/ /UH-1D Huey/ /- CAVALRY/
Platoon10.oob:1190: P106665 8 /UH-1D Huey/ /UH-1D Huey/ /- CAVALRY/
Platoon10.oob:1191: P106666 8 /UH-1D Huey/ /UH-1D Huey/ /- CAVALRY/
Platoon10.oob:1208: P106683 0 /AH-1G Early Cobra(2L2H)/ /AH-1G(2L2H)/ /HueyCobra - CAVALRY/
Platoon10.oob:1216: P106691 16 /UH-1D Huey Recon/ /UH-1D Huey Recon/ /- CAVALRY/
Platoon10.oob:1603: P106711 8 /UH-1D Huey/ /UH-1D Huey/ /--- MARINE/
Platoon10.oob:1604: P106712 8 /UH-1D Huey/ /UH-1D Huey/ /--- MARINE/
Platoon10.oob:1605: P106713 8 /UH-1D Huey/ /UH-1D Huey/ /--- MARINE/
Platoon10.oob:1606: P106714 8 /UH-1N Huey/ /UH-1N Huey/ /--- MARINE/
Platoon10.oob:1607: P106715 8 /UH-1N Huey/ /UH-1N Huey/ /--- MARINE/
Platoon10.oob:1608: P106716 8 /UH-1N Huey/ /UH-1N Huey/ /--- MARINE/
Platoon10.oob:1616: P106724 0 /AH-1G Early Cobra(2L2H)/ /AH-1G(2L2H)/ /HueyCobra --- MARINE/
Platoon10.oob:1620: P106728 16 /UH-1D Huey Recon/ /UH-1D Huey Recon/ /--- MARINE/
Platoon10.oob:2023: P106757 32 /UH-1B Huey/ /UH-1B Huey/ /--- AIRBORNE/
Platoon10.oob:2024: P106758 32 /UH-1B Huey/ /UH-1B Huey/ /--- AIRBORNE/
Platoon10.oob:2025: P106759 32 /UH-1B Huey/ /UH-1B Huey/ /--- AIRBORNE/
Platoon10.oob:2029: P106763 8 /UH-1D Huey/ /UH-1D Huey/ /--- AIRBORNE/
Platoon10.oob:2030: P106764 8 /UH-1D Huey/ /UH-1D Huey/ /--- AIRBORNE/
Platoon10.oob:2031: P106765 8 /UH-1D Huey/ /UH-1D Huey/ /--- AIRBORNE/
Platoon10.oob:2048: P106779 0 /AH-1G Early Cobra(2L2H)/ /AH-1G(2L2H)/ /HueyCobra --- AIRBORNE/
Platoon10.oob:2055: P106786 16 /UH-1D Huey Recon/ /UH-1D Huey Recon/ /--- AIRBORNE/
Platoon11.oob:408: P116503 16 /UH-1D Huey Recon/ /UH-1D Huey Recon/
Platoon11.oob:409: P116504 32 /Bell UH-1 Iroquois/ /UH-1B/ /Huey/
Platoon11.oob:410: P116505 32 /Bell UH-1 Iroquois/ /UH-1B/ /Huey/
Platoon11.oob:411: P116506 32 /Bell UH-1 Iroquois/ /UH-1B/ /Huey/
Platoon11.oob:418: P116507 8 /UH-1D Huey/ /UH-1D Huey/
Platoon11.oob:419: P116508 8 /UH-1D Huey/ /UH-1D Huey/
Platoon11.oob:420: P116509 8 /UH-1D Huey/ /UH-1D Huey/
Platoon12.oob:446: P126507 8 /UH-1D Huey/ /UH-1D Huey/
Platoon12.oob:447: P126508 8 /UH-1D Huey/ /UH-1D Huey/
Platoon12.oob:448: P126509 8 /UH-1D Huey/ /UH-1D Huey/
Platoon17.oob:175: P176502 0 /UH-1D Huey/ /UH-1D Huey/
Platoon17.oob:176: P176503 0 /UH-1D Huey/ /UH-1D Huey/
Platoon17.oob:177: P176504 0 /UH-1D Huey/ /UH-1D Huey/
Platoon19.oob:243: P196502 8 /UH-1H Huey/ /UH-1H Huey/
Platoon19.oob:244: P196503 8 /UH-1H Huey/ /UH-1H Huey/
Platoon19.oob:245: P196504 8 /UH-1H Huey/ /UH-1H Huey/
Platoon49.oob:334: P496513 8 /UH-1D Huey/ /UH-1D Huey/
Platoon49.oob:335: P496514 8 /UH-1D Huey/ /UH-1D Huey/
Platoon49.oob:336: P496515 8 /UH-1D Huey/ /UH-1D Huey/
Platoon50.oob:397: P506508 8 /Helicopter Type 6/ /UH-1D Huey/
Platoon50.oob:398: P506509 8 /Helicopter Type 6/ /UH-1D Huey/
Platoon50.oob:399: P506510 8 /Helicopter Type 6/ /UH-1D Huey/



In your command line:
  • -g vn specifies the Vietnam game. You can specify any of: -g[ame] {me|vn|cw|ef|wf|pf} [for now, only use 'vn']
  • +F says to append the filename to each output line
  • +N says to add the line #s
  • -s/ says to use '/' to separate names, short names & nicknames
  • -m "huey" says to show lines matching "huey" (case insensitive match, so just use lower case)
  • -id -carryflags -name -short -nick says to report the unit ID, carryflag, name, short name, and nickname

You could also try this:



rober@Rob10rto ~/cslint
$ ./csoobrpt.pl -g vn -m "huey" -id -carryflags -name -short -nick
P106514 32 UH-1B Huey UH-1B Huey
P106515 32 UH-1B Huey UH-1B Huey
P106516 32 UH-1B Huey UH-1B Huey
P106521 8 UH-1D Huey UH-1D Huey
P106522 8 UH-1D Huey UH-1D Huey
P106523 8 UH-1D Huey UH-1D Huey
P106549 0 AH-1G Early Cobra(2L2H) AH-1G(2L2H) HueyCobra
[... output omitted for brevity ...]
P106779 0 AH-1G Early Cobra(2L2H) AH-1G(2L2H) HueyCobra --- AIRBORNE
P106786 16 UH-1D Huey Recon UH-1D Huey Recon --- AIRBORNE
P116503 16 UH-1D Huey Recon UH-1D Huey Recon
P116504 32 Bell UH-1 Iroquois UH-1B Huey
P116505 32 Bell UH-1 Iroquois UH-1B Huey
P116506 32 Bell UH-1 Iroquois UH-1B Huey



omitting the '+F +N -s/'.

Instead of specifying data parameters (as in '-id -carryflags -name -short -nick'), you could show them all using the '-ALL' argument, as in:



rober@Rob10rto ~/cslint
$ ./csoobrpt.pl -g vn -F -N -m "birddog" -ALL
P106564 1 0 18 45 99 99 204 204 0 0 0 12 3 7 5 0 375 129 P106564 10 65536 0 0 134225936 536 0 48 1 75 12 0 0 0 Birddog Birddog
P106565 2 0 18 0 99 99 204 204 0 0 0 12 3 7 5 0 375 129 P106564 10 65536 3 0 134225936 536 0 48 1 75 12 0 0 0 Birddog Birddog
P106693 2 0 18 45 99 99 204 204 0 0 0 12 3 31 1 0 375 129 P106693 10 65536 0 0 134225936 536 0 48 1 75 12 0 0 0 Birddog Birddog - CAVALRY
P106694 1 0 18 45 99 99 204 204 0 0 0 12 3 31 1 0 375 129 P106693 10 65536 3 0 134225936 536 0 48 1 75 12 0 0 0 Birddog Birddog - CAVALRY
P106788 2 0 18 45 0 0 204 204 0 0 0 12 3 43 3 0 375 129 P106788 10 65536 0 0 134225936 536 0 48 1 85 12 0 0 0 Birddog Birddog - AIRBORNE
P106789 1 0 18 45 0 0 204 204 0 0 0 12 3 43 3 0 375 129 P106788 10 65536 3 0 134225936 536 0 48 1 85 12 0 0 0 Birddog Birddog - AIRBORNE
P116502 1 0 18 45 50 50 204 204 0 0 0 12 3 7 5 0 375 129 P116502 10 65536 0 0 134225936 536 0 55 1 75 12 0 0 0 Cessna O-1 Birddog Birddog
P126501 1 0 34 40 50 50 204 204 0 0 0 12 3 7 0 0 375 129 P126501 10 65536 0 0 134225936 536 0 50 1 85 12 0 0 0 O-1/L-19 Birddog O-1/L-19



For many csoobrpt.pl commands, the output might flood the screen, especially if you omitted the -m parameter to only match certain unit names. In that case, you could either scroll back your WSL (or Cygwin) terminal window, or you could use the 'less' command, as in:



rober@Rob10rto ~/cslint
$ ./csoobrpt.pl -g vn +F +N -s/ -m "commander" -ALL | less



While running less, use these keys:
  • f, to move forward one page
  • b, to move backward one page
  • j, to move down one line
  • k, to move backward one line
  • 1G, to go to the beginning of the output
  • G, to go to the end of the output
  • /match, to do a forward search on the match string, as in: /sherman
  • ?match, to do a backward search on the match string, as in: ?huey
  • q to quit

Also NOTE: In your terminal window command line, use the cursor up key to recall previous commands. Use the cursor down key to recall later commands. You can use the left arrow, right arrow keys to move back and forth in a recalled command. Also use backspace, delete, etc. to edit a recalled command.

It's when you "pipe" (via the | connector) csoobrpt.pl output to various combinations of other WSL Linux tools -- that's where the real power and capability of this shines. For example:



rober@Rob10rto ~/cslint
$ ./csoobrpt.pl -g vn +F +N -s/ -id -speed -name -short -nick | awk '$3>900'
Platoon10.oob:705: P105023 1000 /Republic F-105 Thunderchief {Bombs}/ /F-105D/ /Thud/
Platoon10.oob:769: P105053 1000 /Lockheed F-117 Nighthawk {Guided}/ /F-117/ /Nighthawk/



which shows all units with speed values greater than 900 -- outliers, and possibly mistaken?

Another example:



rober@Rob10rto ~/cslint
$ ./csoobrpt.pl -g vn -F -N -moveflags | sort | uniq | sort -n
0
2
5
8
16
33
36
40
48
97
129
130
136
161
168
176
512
1024
2048
4096
4100
8192
32768
32770
65536
131072
262144



If any of those numbers looks "funny", you can easily spot it.

Another example:



rober@Rob10rto ~/cslint
$ ./csoobrpt.pl -g vn +F +N -s/ -id -startyear -stopyear -name -short -nick | awk '$3>=62 && $4<=72'
Platoon10.oob:508: P102081 62 70 /Reconnaissance 62/ /Reconnaissance 62/ /(M14, M79, M60, LAW, Claymore)/
Platoon10.oob:660: P106571 64 69 /AC47 Gunship/ /AC47 Gunship/ /Spooky/
Platoon10.oob:741: P105039 62 70 /USN McDonnell Douglas F-4B Phantom II {Bombs}/ /F-4B/ /Phantom II/
Platoon10.oob:742: P105091 62 70 /USN McDonnell Douglas F-4B Phantom II {Bombs II}/ /F-4B/ /Phantom II/
Platoon10.oob:743: P105092 62 70 /USN McDonnell Douglas F-4B Phantom II {Napalm}/ /F-4B/ /Phantom II/
Platoon10.oob:744: P105040 62 70 /USAF McDonnell Douglas F-4C Phantom II {Bombs}/ /F-4C/ /Phantom II/
Platoon10.oob:745: P105093 62 70 /USAF McDonnell Douglas F-4C Phantom II {Bombs II}/ /F-4C/ /Phantom II/
Platoon10.oob:746: P105094 62 70 /USAF McDonnell Douglas F-4C Phantom II {Napalm}/ /F-4C/ /Phantom II/
Platoon10.oob:1104: P102551 62 70 /Reconnaissance 62/ /Reconnaissance 62/ /(M14, M79, M60, LAW, Claymore) - CAVALRY/
Platoon10.oob:1205: P106680 65 70 /UH-1C Gunship/SS-11/ /UH-1C Gunship/SS-11/ /- CAVALRY/
Platoon10.oob:1258: P100637 63 72 /M132 Flamethrowers/ /M132/ /Zippo --- MARINE/
Platoon10.oob:1527: P102614 62 70 /Marine Reconnaissance 62/ /Marine Recce 62/ /(M14, M79, M60, LAW, Claymore) --- MARINE/
Platoon10.oob:1951: P102856 62 70 /Reconnaissance 62/ /Reconnaissance 62/ /(M14, M79, M60, LAW, Claymore) - AIRBORNE/
Platoon11.oob:45: P116010 62 65 /M114 Reconnaissance Vehicle/ /M114/
Platoon11.oob:46: P116011 62 65 /M114 Reconnaissance Vehicle/ /M114/
Platoon11.oob:202: P112103 62 70 /Reconnaissance 62/ /Reconnaissance 62/ /(M14, M79, M60, LAW, Claymore)/
Platoon11.oob:203: P112104 62 70 /Reconnaissance 62/ /Reconnaissance 62/ /(M14, M79, M60, LAW, Claymore)/
Platoon11.oob:247: P112097 64 72 /MACV/SOG Road Runners/ /Road Runners/
Platoon12.oob:46: P121007 67 7 /M84 Self-Propelled 4.2" Mortar/ /M84/
Platoon12.oob:283: P122016 62 69 /Rifle Platoon 62 A/ /Rifle 62A/ /M1/M1&M2 Carbine, M7GL, M1918BAR, M1919A6, Bazooka/
Platoon12.oob:284: P122017 62 69 /Rifle Platoon 62 B/ /Rifle 62B/ /M1/M1 Carbine, M7GL, M1918BAR, M1919A6, Bazooka/
Platoon12.oob:285: P122018 62 69 /Rifle Platoon 62 C/ /Rifle 62C/ /M1/M1&M2 Carbine, M7GL, M1918BAR, M1919A6, Bazooka/
Platoon13.oob:178: P132043 62 69 /Action Team 62/ /Action Team 62/ /USA (M1 SAR, M1A1 SMG, M1918A2 LMG)(Can Lay Mines)/
Platoon49.oob:324: P496503 64 69 /AC47 Gunship/ /AC47 Gunship/ /Spooky/
Platoon50.oob:257: P502019 62 69 /Rifle Platoon 62 A/ /Rifle 62A/ /(M1/M1&M2 Carbine, M7GL, M1918BAR, M1919A6, Bazooka)/
Platoon50.oob:258: P502020 62 69 /Rifle Platoon 62 B/ /Rifle 62B/ /(M1/M1 Carbine, M7GL, M1918BAR, M1919A6, Bazooka)/
Platoon50.oob:259: P502021 62 69 /Rifle Platoon 62 C/ /Rifle 62C/ /(M1/M1&M2 Carbine, M7GL, M1918BAR, M1919A6, Bazooka)/



which shows all units available between 1962 & 1972, but not before or after.

Here is a csoobrpt.pl technique to discover all units capable of firing 3 or more times per turn:



rober@Rob10rto ~/cslint
$ ./csoobrpt.pl -id -firingcost -name -short -nick -g vn | awk '$2!=0 && $2<=33'
P006001 33 BA-64B Armored Cars PLA BA-64B
P008004 33 FlaK 30 20mm Anti-Aircraft Guns PLA 20mm AAA FlaK 30
P008005 33 OQF 40mm Anti-Aircraft Guns PLA 40mm AAA OQF 40mm
P008006 33 ZPU-2 14.5mm Anti-Aircraft Guns ZPU-2 14.5mm AAA
P008007 33 ZPU-4 14.5mm Anti-Aircraft Guns ZPU-4 14.5mm AAA
P008008 33 ZU-23 23mm Anti-Aircraft Guns ZU-23 23mm AAA ZU-23
P008009 33 Type 55 37mm Anti-Aircraft Guns Type 55 37mm AAA Type 55
P002003 33 PLA Rifle Platoon 48 A(Japanese Arms) PLA Rifle 48 A(J)
P002006 33 PLA Rifle Platoon 48 A(U.S. Arms) PLA Rifle 48 A(US)
[... output omitted for brevity ...]
P502059 33 Parachute Platoon 68 B Parachute 68B M-16, M60, M72 LAW
P502060 30 Parachute Platoon 70 A Parachute 70A M-16, M60, M72 LAW
P502061 33 Parachute Platoon 70 B Parachute 70B M-16, M60, M72 LAW
P502062 30 Parachute Platoon 81 A Parachute 81A M-16, M60, M72 LAW
P502063 33 Parachute Platoon 81 B Parachute 81B M-16, M60, M72 LAW
P502090 33 Engineer Platoon 48 Engineer 48 Type 46
P502097 33 Scout Dog Squad Scout Dog



By employing the egrep command, we can limit that output to French nation #08 units only:



rober@Rob10rto ~/cslint
$ ./csoobrpt.pl -id -firingcost -name -short -nick -g vn | awk '$2!=0 && $2<=33' | egrep "^P08"
P088001 33 M3 HT Twin 20mm M3 HT Twin 20mm
P088002 33 AMX-13 DCA Twin 30mm AMX-13 DCA
P088003 33 AMX-13 DCA Twin 30mm AMX-13 DCA
P088004 33 AMX-13 DCA Twin 30mm AMX-13 DCA
P088005 33 AMX-30 Roland AMX-30 Roland
P088006 33 AMX-30 Roland AMX-30 Roland
[... output omitted for brevity ...]
P082101 33 Light Machine Gun 52 LMG 52 AA-52
P082102 33 Medium Machine Gun 52 MMG 52 AA-52
P082103 33 Medium Machine Gun 52 MMG 52 AA-52
P082104 33 Medium Machine Gun 52 MMG 52 AA-52
P083013 33 Fixed Supply Depot (HQ) Supply Depot (HQ)
P083014 33 Fixed Fuel Supply Depot (HQ) Fuel Supply Depot (HQ)



Here's an interesting QA (Quality Assurance) check:



rober@Rob10rto ~/cslint
$ ./csoobrpt.pl -F -g vn -startyear | egrep -v "BAD LINE" | sort | uniq | sort -n
45
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85



This says
  • for the game Vietnam
  • for all units, show their startyear
  • (filter out any reported BAD LINEs)
  • pipe the output to 'sort | uniq | sort -n'
thereby showing the range of startyear for all units in the game.

Here is a way to find units with unusually high assault values:



rober@Rob10rto ~/cslint
$ ./csoobrpt.pl -g vn -id -assault -name -nick | awk '$2>=20'
P009012 300 PLA Tank Hunter Section 50 (Satchel Charges)
P009021 20 PLA Pole Mine
P100071 20 POA-CWS-H5 Flamethrower Tanks Sherman
P100072 20 POA-CWS-H5 Flamethrower Tanks Sherman
P100073 20 M132 Flamethrowers Zippo
P100075 20 M67 Flamethrower Tanks Zippo
P100571 20 M132 Flamethrowers Zippo - CAVALRY
P100573 20 M67 Flamethrower Tanks Zippo - CAVALRY
P100635 20 POA-CWS-H5 Flamethrower Tanks Sherman --- MARINE
P100636 20 POA-CWS-H5 Flamethrower Tanks Sherman --- MARINE
P100637 20 M132 Flamethrowers Zippo --- MARINE
P100639 20 M67 Flamethrower Tanks Zippo --- MARINE
P100844 20 M132 Flamethrowers Zippo --- AIRBORNE
P100846 20 M67 Flamethrower Tanks Zippo --- AIRBORNE
P110012 20 M132 Flamethrowers
P120032 20 M132 Flamethrowers
P212094 300 Suicide Squad
P500020 20 M132 Flamethrowers



Over the course of this CSlint series and follow-up discussion, you will see many other examples of csoobrpt.pl usage in this and other threads (including further explanation of using awk, sort, uniq, and other WSL Linux tools). But the above should be enough to get you started.

If you have questions, just ask here in the Forum.

Good luck! Happy data mining!
Campaign Series Legion https://cslegion.com/
Campaign Series Lead Coder https://www.matrixgames.com/forums/view ... hp?f=10167
Panzer Campaigns, Panzer Battles Lead Coder https://wargameds.com
User avatar
berto
Posts: 21461
Joined: Wed Mar 13, 2002 1:15 am
Location: metro Chicago, Illinois, USA
Contact:

Re: CSlint How-To

Post by berto »

csflags.pl


csflags.pl is a Perl script (program) to convert platoon*.oob flag values to their flag name equivalents, and vice versa.

Start by displaying the program help:



rober@Rob10rto ~/cslint
$ ./csflags.pl -h

Usage: csflags.pl [-h|-help] [{+|-}G|-debug] [-s<char>|-separator<char>] -g[ame] {me|vn|cw|ef|wf|pf} {-move|-carry|-fire|-other|-more|-morefire} {<number>|"<flags>"}



For Vietnam (or Middle East or ...) specific help, add the option '-g vn' (or '-g me' or ...):



rober@Rob10rto ~/cslint
$ ./csflags.pl -h -g vn

Usage: csflags.pl [-h|-help] [{+|-}G|-debug] [-s<char>|-separator<char>] -g[ame] {me|vn|cw|ef|wf|pf} {-move|-carry|-fire|-other|-more|-morefire} {<number>|"<flags>"}

move flags: XTracked/XFoot/XHalftrack/XArmoredCar/XTruck/XNoLtBridge/XNoMedBridge/XAmphibious/XSki/XMotorcycle/XTrain/XHorse/XBoat/XWagon/XNoHvyBridge/XTunnel/XAir/XShip/XRaft

carry flags: XLoadable/XRidable/XTowable/XCarryAll/XCarryRider/XCarryTow/XTowOnly/XPortage/XCanMotor/XCanBicycle/XCanHorse/XHeavyGun/XCarryHorse/XCarryBicycle/XCarryMotor/XCarryBoat

fire flags: XHardTarget/XNormalAA/XReducedAA/XIndirectFire/XSmokeFiring/XFireWater/XWhiteP/XSAM/XATGM/XGunship/XSneaker/XATG/XAAA/XFFATG/XManSAM/XWideArea

other flags: XCanDigIn/XMineClearing/XFireHardAI/XFireSoftAI/XReconAI/XAssaultAI/XRetreatAI/XCanDamage/XCarryAny/XCarryVehicle/XPathfinder/XOffBoardAirPlane/XHelicopter/XOnBoardAirPlane/XRecovery/XBuildVehicleBridge/XBuildLightBridge/XSpecOps/XCommando/XHighFlying/XLowFlying/XBomber/XDiveBomber/XFastMover/XGroundAttack/XFAC/XMultistrike/XLoiter

more flags: XAssault/XOffAT/XDefAT/XInfSup/XFireHelo/XLayMines/XErectBarrier/XSuicide/XReconUnit/XFastUnit/XShovels/XRaider/XNightVision/XSetIED/XLayManyMines/XArtyAmmo/XGunshipAmmo/XSAMControl/XHighVis/XNoFireHelo/XFireHeloShort/XSupply

morefire flags: XGuns/XRockets/XBombs/XBombsII/XNapalm/XSmartMunitions/XFireForget/XDaisyCutter/XChemical/XTacticalNukes



Before we get to actual csflags.pl usage, let's review csoobrpt.pl (see our previous post):



rober@Rob10rto ~/cslint
$ ./csoobrpt.pl -h -g vn

Usage: csoobrpt.pl [-h|-help] [{+|-}i|{+|-}insensitive] [{+|-}G|-debug] -g[ame] {me|vn|cw|ef|wf|pf} [{+|-}F|{+|-}show_files] [{+|-}N|{+|-}show_linenos] [-s<char>|-separator<char>] [-m "<string>"|-match "<string>"] [<parameters list>|-ALL]

parameters list:
-1 or -id
-2 or -strength
-3 or -assault
-4 or -defend
-5 or -firingcost
-6 or -loadingcost
-7 or -unloadingcost
-8 or -speed
-9 or -xcspeed
-10 or -weight
-11 or -pressure
-12 or -concealment
-13 or -movesound
-14 or -firesound
-15 or -countercell2d
-16 or -basecell3d
-17 or -animate
-18 or -type1d (NATO symbol)
-19 or -type2d (unit icon)
-20 or -bitmap3d
-21 or -points
-22 or -moveflags
-23 or -carryflags
-24 or -fireflags
-25 or -otherflags
-26 or -moreflags
-27 or -morefireflags
-28 or -startyear
-29 or -startmonth
-30 or -stopyear
-31 or -stopmonth
-32 or -frontmod
-33 or -sidemod
-34 or -rearmod
-35 or -name
-36 or -short
-37 or -nick



By using the -ALL switch, remember that we can show all of those 37 unit parameters, not just some of them. For instance:



rober@Rob10rto ~/cslint
$ ./csoobrpt.pl -g vn -F -N -m "dozer" -ALL
P007019 2 0 2 0 50 50 48 24 5 1 4 1 0 5 0 0 70 116 P007019 2 33 0 0 1217 4198465 0 48 1 85 12 0 0 0 BAT-M Dozers BAT-M Dozers
P007020 4 2 2 40 50 50 15 15 5 1 4 1 0 5 0 0 382 149 P007020 2 33 64 0 1217 4198465 0 55 1 85 12 1 1 1 Dozers Dozers
P088803 2 2 2 40 50 50 15 15 5 1 4 1 0 5 0 0 86 79 P088803 5 33 5 1 1217 4198465 0 48 1 85 12 3 1 1 Dozers Dozers
P100069 2 3 11 35 50 50 38 15 33 2 4 1 11 5 0 1 382 9 P100069 5 33 16 1 4211149 2097217 0 48 1 61 12 13 6 5 M4A3 Dozer M4A3 Dozers Sherman Dozer
P106811 4 2 2 40 50 50 15 15 5 1 4 1 0 5 0 0 86 141 P106811 2 33 5 1 1217 4198465 128 48 1 85 12 0 0 0 Dozers Dozers
P100570 2 3 11 35 50 50 38 15 33 2 4 1 11 29 1 1 382 9 P100570 5 33 16 1 4211149 2097217 0 48 1 61 12 13 6 5 M4A3 Dozer M4A3 Dozers Sherman Dozer - CAVALRY
P107463 2 2 2 40 50 50 15 15 5 1 4 1 0 29 1 0 86 141 P107463 2 33 5 1 1217 4198465 128 48 1 85 12 0 0 0 Dozers Dozers - CAVALRY
P100633 2 3 11 35 50 50 38 15 33 2 4 1 11 17 2 1 382 9 P100633 5 33 16 1 4211149 2097217 0 48 1 68 12 13 6 5 M4A3 Dozer M4A3 Dozers Sherman Dozer --- MARINE
P107568 2 2 2 45 50 50 15 15 5 1 4 1 0 17 2 0 86 141 P107568 2 33 5 1 1217 4198465 128 48 1 85 12 0 0 0 Dozers Dozers --- MARINE
P100843 2 3 11 35 50 50 38 15 33 2 4 1 11 41 3 1 382 9 P100843 5 33 16 1 4211149 2097217 0 48 1 61 12 13 6 5 M4A3 Dozer M4A3 Dozers Sherman Dozer --- AIRBORNE
P107762 2 2 2 40 50 50 15 15 5 1 4 1 0 41 3 0 86 141 P107762 2 33 5 1 1217 4198465 128 48 1 85 12 0 0 0 Dozers Dozers --- AIRBORNE
P117035 4 2 2 40 50 50 15 15 5 1 4 1 0 5 1 0 86 64 P117035 2 33 5 1 1217 4198465 0 48 1 75 12 2 1 1 Dozers Dozers
P127055 4 2 2 40 50 50 15 15 5 1 4 1 0 5 0 0 86 64 P127055 2 33 5 1 1217 4198465 0 48 1 85 12 2 1 1 Dozers Dozers
P130012 2 7 14 45 50 50 42 21 36 2 4 1 11 0 0 1 382 22 P130012 7 33 16 1 4211149 2097217 0 75 1 85 12 32 12 10 T-55 Dozer Tank T-55 BTU
P177035 4 2 2 40 50 50 15 15 5 1 4 1 0 5 0 0 86 143 P177035 2 33 5 1 1217 4198465 0 48 1 85 12 2 1 1 Dozers Dozers
P197048 2 2 2 40 50 50 15 15 5 1 4 1 0 5 0 0 86 143 P197048 2 33 5 1 1217 4198465 0 48 1 85 12 2 1 1 Dozers Dozers
P218802 2 2 5 40 50 50 48 24 34 3 5 1 3 5 0 0 86 143 P218802 2 33 5 1 1217 4198465 0 56 1 75 12 2 1 1 BAT-M Dozers Dozers
P218813 2 2 5 40 50 50 48 24 34 3 5 1 3 41 3 0 86 143 P218802 2 33 5 1 1217 4198465 0 75 1 85 12 2 1 1 BAT-M Dozers Dozers
P490016 2 7 14 45 50 50 42 21 36 2 4 1 11 5 0 1 70 22 P490016 7 33 16 1 1153 2113615 0 75 1 85 12 32 12 10 T-55 Dozer Tank T-55 BTU
P507060 2 2 2 40 50 50 15 15 5 1 4 1 0 5 0 0 86 64 P507060 5 33 5 1 1217 4198465 0 51 1 85 12 2 1 1 Dozers Dozers



In the above output, for the American M4A3 Dozer, I have highlighted the fields



-22 or -moveflags
-23 or -carryflags
-24 or -fireflags
-25 or -otherflags
-26 or -moreflags
-27 or -morefireflags



Let's use clflags.pl to interpret those highlighted numbers.



rober@Rob10rto ~/cslint
$ ./csflags.pl -g vn -move 33
XTracked/XNoLtBridge

rober@Rob10rto ~/cslint
$ ./csflags.pl -g vn -carry 16
XCarryRider

rober@Rob10rto ~/cslint
$ ./csflags.pl -g vn -fire 1
XHardTarget

rober@Rob10rto ~/cslint
$ ./csflags.pl -g vn -other 4211149
XCanDigIn/XFireHardAI/XFireSoftAI/XRetreatAI/XCanDamage/XCarryAny/XRecovery/XDiveBomber

rober@Rob10rto ~/cslint
$ ./csflags.pl -g vn -more 2097217
XAssault/XErectBarrier/XNoFireHelo

rober@Rob10rto ~/cslint
$ ./csflags.pl -g vn -morefire 0



Oh! Look at the -other output. XDiveBomber? Oops! Seems there is a mistake!

We can fix that mistake by reversing the conversion. Instead of number -> parameters list, we can try parameters list -> number. And by omitting the XDiveBomber from the parameters list:



rober@Rob10rto ~/cslint
$ ./csflags.pl -g vn -other XCanDigIn/XFireHardAI/XFireSoftAI/XRetreatAI/XCanDamage/XCarryAny/XRecovery
16845



We would then edit the OOBs/Platoon10.oob file, substituting 4211149 -> 16845, with this result:



P100570 2 3 11 35 50 50 38 15 33 2 4 1 11 29 1 1 382 9 P100570 5 33 16 1 16845 2097217 0 48 1 61 12 13 6 5 M4A3 Dozer M4A3 Dozers Sherman Dozer - CAVALRY



Before we move on, let's doublecheck that new, replacement parameter #:



rober@Rob10rto ~/cslint
$ ./csflags.pl -g vn -other 16845
XCanDigIn/XFireHardAI/XFireSoftAI/XRetreatAI/XCanDamage/XCarryAny/XRecovery



Yup, looks right. See where the mistaken XDiveBomber parameter is indeed gone.

Are there other mistaken parameters in the many, many unit specifications? Most probably! We are not infallible! Neither are we tireless. You help us out, you get a better game, by employing CSlint utilities like csflags.pl to review and scrutinize the unit definitions etc. Show us the error of our ways!

Try this command:



rober@Rob10rto ~/cslint
$ ./csflags.pl -g me -carry 131
XLoadable/XRidable/XPortage



which, for the game Middle East, shows you the meaning of the carryflag value 131.

Try this:



rober@Rob10rto ~/cslint
$ ./csflags.pl -g vn -move "XTracked/XHalftrack/XNoLtBridge/XNoMedBridge/XNoHvyBridge"
16485



which, for the Vietnam game, shows that the combined moveflags XTracked/XHalftrack/XNoLtBridge/XNoMedBridge/XNoHvyBridge have the value 16485.

Try this:



rober@Rob10rto ~/cslint
$ ./csflags.pl -g vn -fire "XGunship/XSmokeFiring/XFireWater"
560



which, again for the Vietnam game, shows that the combined fireflags XGunship/XSmokeFiring/XFireWater have the value 560.

Try this:



rober@Rob10rto ~/cslint
$ ./csflags.pl -fire "XGunship/XSmokeFiring/XFireWater"

please specify a game

Usage: csflags.pl [-h|-help] [{+|-}G|-debug] [-s<char>|-separator<char>] -g[ame] {me|vn|cw|ef|wf|pf} {-move|-carry|-fire|-other|-more|-morefire} {<number>|"<flags>"}



which shows that if you fail to specify the game, by means of the -g option, the program complains, and outputs the program help.

Try this:



rober@Rob10rto ~/cslint
$ ./csflags.pl -g wf -fire "XGunship/XSmokeFiring/XFireWater/XNoSuchFlag"

no such fire flag: XNoSuchFlag

Usage: csflags.pl [-h|-help] [{+|-}G|-debug] [-s<char>|-separator<char>] -g[ame] {me|vn|cw|ef|wf|pf} {-move|-carry|-fire|-other|-more|-morefire} {<number>|"<flags>"}

move flags: XTracked/XFoot/XHalftrack/XArmoredCar/XTruck/XNoLtBridge/XNoMedBridge/XAmphibious/XSki/XMotorcycle/XTrain/XHorse/XBoat/XWagon/XNoHvyBridge/XTunnel/XAir/XShip/XRaft

carry flags: XLoadable/XRidable/XTowable/XCarryAll/XCarryRider/XCarryTow/XTowOnly/XPortage/XCanMotor/XCanBicycle/XCanHorse/XHeavyGun/XCarryHorse/XCarryBicycle/XCarryMotor/XCarryBoat

fire flags: XHardTarget/XNormalAA/XReducedAA/XIndirectFire/XSmokeFiring/XFireWater/XWhiteP/XSAM/XATGM/XGunship/XSneaker/XATG/XAAA/XFFATG/XManSAM/XWideArea

other flags: XCanDigIn/XMineClearing/XFireHardAI/XFireSoftAI/XReconAI/XAssaultAI/XRetreatAI/XCanDamage/XCarryAny/XCarryVehicle/XPathfinder/XOffBoardAirPlane/XHelicopter/XOnBoardAirPlane/XRecovery/XBuildVehicleBridge/XBuildLightBridge/XSpecOps/XCommando/XHighFlying/XLowFlying/XBomber/XDiveBomber/XFastMover/XGroundAttack/XFAC/XMultistrike/XLoiter

more flags: XAssault/XOffAT/XDefAT/XInfSup/XFireHelo/XLayMines/XErectBarrier/XSuicide/XReconUnit/XFastUnit/XShovels/XRaider/XNightVision/XSetIED/XLayManyMines/XArtyAmmo/XGunshipAmmo/XSAMControl/XHighVis/XNoFireHelo/XFireHeloShort/XSupply

morefire flags: XGuns/XRockets/XBombs/XBombsII/XNapalm/XSmartMunitions/XFireForget/XDaisyCutter/XChemical/XTacticalNukes



As you can see from the last example, if you specify an unknown flag (known flags are listed in the help display), the program complains, and dumps the usage/help display.

For csflags.pl, you probably should enclose flags with quotes, but it's generally not needed. That is, you could instead do (without the quotes):



rober@Rob10rto ~/cslint
$ ./csflags.pl -g vn -fire XGunship/XSmokeFiring/XFireWater
560



By means of the optional '[-s<char>|-separator<char>]' command-line parameter, you can change the flag name separator, as in:



rober@Rob10rto ~/cslint
$ ./csflags.pl -g me -s# -other 289
XCanDigIn#XAssaultAI#XCarryAny



For the -s parameter, do not use '|' (the "pipe" symbol). It won't work!

Let's check out the gunship Spooky:



rober@Rob10rto ~/cslint
$ ./csoobrpt.pl -g vn -F -N -m "spooky" -ALL
P106571 1 0 8 34 99 99 250 250 0 0 0 12 32 7 6 1 248 129 P106571 15 65536 0 16896 134225920 16400 0 64 12 69 12 0 0 0 AC47 Gunship AC47 Gunship Spooky
P496503 1 0 8 34 50 50 250 250 0 0 0 12 2 7 1 1 248 129 P496503 15 65536 0 16904 8200 16400 0 64 12 69 12 0 0 0 AC47 Gunship AC47 Gunship Spooky



Some interesting numbers there. Let's see what those highlighted numbers signify:



$ ./csflags.pl -g vn -s# -fire 16896
XGunship#XFFATG

rober@Rob10rto ~/cslint
$ ./csflags.pl -g vn -s# -other 134225920
XOnBoardAirPlane#XLoiter

rober@Rob10rto ~/cslint
$ ./csflags.pl -g vn -s# -more 16400
XFireHelo#XNightVision



Let's have a look at the NVA sappers:



rober@Rob10rto ~/cslint
$ ./csoobrpt.pl -g vn -F -N -m "nva.*sapper" -ALL
P212032 6 9 7 34 50 25 12 6 0 2 0 0 0 5 0 0 344 124 P212032 3 32770 1155 1024 327811 4195853 0 56 1 69 12 0 0 0 NVA Sapper Platoon 56 NVA Sapper 56 SKS
P212002 6 12 7 33 50 25 12 6 0 2 0 0 1 5 0 0 344 124 P212002 3 32770 1155 1024 327811 4195853 0 63 1 75 12 0 0 0 NVA Sapper Platoon 63 NVA Sapper 63 AK
P212036 6 9 7 35 50 25 12 6 0 2 0 0 0 5 0 0 428 120 P212036 3 130 1155 1024 65539 4194317 0 56 1 69 12 0 0 0 NVA Water Sapper Platoon 56 NVA Water Sapper 56 SKS
P212006 6 12 7 35 50 25 12 6 0 2 0 0 1 5 0 0 428 120 P212006 3 130 1155 1024 65539 4194317 0 63 1 75 12 0 0 0 NVA Water Sapper Platoon 63 NVA Water Sapper 63 AK



For the highlighted unit flags:



rober@Rob10rto ~/cslint
$ ./csflags.pl -g vn -move 32770
XFoot/XTunnel

rober@Rob10rto ~/cslint
$ ./csflags.pl -g vn -carry 1155
XLoadable/XRidable/XPortage/XCanBicycle

rober@Rob10rto ~/cslint
$ ./csflags.pl -g vn -fire 1024
XSneaker

rober@Rob10rto ~/cslint
$ ./csflags.pl -g vn -other 327811
XCanDigIn/XMineClearing/XCanDamage/XBuildLightBridge/XCommando

rober@Rob10rto ~/cslint
$ ./csflags.pl -g vn -more 4195853
XAssault/XDefAT/XInfSup/XReconUnit//XFireHeloShort

rober@Rob10rto ~/cslint
$ ./csflags.pl -g vn -morefire 0



Hmm. We haven't seen any non-zero morefire. Let's check American Skyraiders for napalm:



rober@Rob10rto ~/cslint
$ ./csoobrpt.pl -g vn -F -N -m "napalm.*skyraider" -ALL[/color]
P105064 2 0 13 34 99 99 320 320 0 0 0 12 32 7 6 1 376 129 P105014 10 65536 0 0 103809024 0 16 48 1 75 12 0 0 0 Douglas A-1 Skyraider {Napalm} A-1 Skyraider
P105109 2 0 13 34 99 99 520 520 0 0 0 12 32 7 6 1 376 129 P106747 10 65536 0 0 103809024 0 16 50 1 73 12 0 0 0 Douglas A-1 Skyraider {Napalm} A-1 Skyraider ---MARINE
P115003 2 0 13 34 99 99 320 320 0 0 0 12 32 7 6 1 376 129 P115002 12 65536 0 0 103809024 0 16 60 1 75 12 0 0 0 Douglas A-1 Skyraider {Napalm} A-1 Skyraider

rober@Rob10rto ~/cslint
$ ./csflags.pl -g vn -morefire 16
XNapalm



Napalm? Confirmed!

And so on.

You will see many other examples of csflags.pl usage in this and other threads (including further explanation of using other WSL Linux tools). But the above should be enough to get you started.

If you have questions, just ask here in the Forum.

Good luck! Happy unit making! Happy parameter tweaking/fixing!
Campaign Series Legion https://cslegion.com/
Campaign Series Lead Coder https://www.matrixgames.com/forums/view ... hp?f=10167
Panzer Campaigns, Panzer Battles Lead Coder https://wargameds.com
User avatar
berto
Posts: 21461
Joined: Wed Mar 13, 2002 1:15 am
Location: metro Chicago, Illinois, USA
Contact:

Re: CSlint How-To

Post by berto »

csflgrpt.pl


csflgrpt.pl is a Perl script (program) to report units with the specified attribute flags.

(Note: In the course of preparing this, we discovered some csflgrpt.pl bugs in the currently available public CSlint release. The fixed csflgrpt.pl will be included in CSVN v1.20 and later. Until then, if you try the exercises following, your results might vary.)

Start by displaying the program help:



rober@Rob10rto ~/cslint
$ ./csflgrpt.pl -help

Usage: csflgrpt.pl [-h|-help] [{+|-}G|-debug] -g[ame] {me|vn|cw|ef|wf|pf} {-move|-carry|-fire|-other|-more|-morefire} <Xflag> [{-name|-short|-nick}]



If you specify the game, you get more extensive help:



rober@Rob10rto ~/cslint
$ ./csflgrpt.pl -h -g vn

Usage: csflgrpt.pl [-h|-help] [{+|-}G|-debug] -g[ame] {me|vn|cw|ef|wf|pf} {-move|-carry|-fire|-other|-more|-morefire} <Xflag> [{-name|-short|-nick}]


move flags: XTracked/XFoot/XHalftrack/XArmoredCar/XTruck/XNoLtBridge/XNoMedBridge/XAmphibious/XSki/XMotorcycle/XTrain/XHorse/XBoat/XWagon/XNoHvyBridge/XTunnel/XAir/XShip/XRaft

carry flags: XLoadable/XRidable/XTowable/XCarryAll/XCarryRider/XCarryTow/XTowOnly/XPortage/XCanMotor/XCanBicycle/XCanHorse/XHeavyGun/XCarryHorse/XCarryBicycle/XCarryMotor/XCarryBoat

fire flags: XHardTarget/XNormalAA/XReducedAA/XIndirectFire/XSmokeFiring/XFireWater/XWhiteP/XSAM/XATGM/XGunship/XSneaker/XATG/XAAA/XFFATG/XManSAM/XWideArea

other flags: XCanDigIn/XMineClearing/XFireHardAI/XFireSoftAI/XReconAI/XAssaultAI/XRetreatAI/XCanDamage/XCarryAny/XCarryVehicle/XPathfinder/XOffBoardAirPlane/XHelicopter/XOnBoardAirPlane/XRecovery/XBuildVehicleBridge/XBuildLightBridge/XSpecOps/XCommando/XHighFlying/XLowFlying/XBomber/XDiveBomber/XFastMover/XGroundAttack/XFAC/XMultistrike/XLoiter

more flags: XAssault/XOffAT/XDefAT/XInfSup/XFireHelo/XLayMines/XErectBarrier/XSuicide/XReconUnit/XFastUnit/XShovels/XRaider/XNightVision/XSetIED/XLayManyMines/XArtyAmmo/XGunshipAmmo/XSAMControl/XHighVis/XNoFireHelo/XFireHeloShort/XSupply

morefire flags: XGuns/XRockets/XBombs/XBombsII/XNapalm/XSmartMunitions/XFireForget/XDaisyCutter/XChemical/XTacticalNukes



For Vietnam, let's see all units with the XWagon move flag:



rober@Rob10rto ~/cslint
$ ./csflgrpt.pl -g vn -move XWagon
P007060 8192 32 0 0 0 0 Wagons
P007061 8192 32 0 0 0 0 Wagons
P007062 8192 32 0 0 0 0 Wagons
P007063 8192 32 0 0 0 0 Wagons
P007064 8192 32 0 0 0 0 Pack Horses
P007065 8192 32 0 0 0 0 Pack Horses
P007066 8192 32 0 0 0 0 Pack Horses
P007067 8192 32 0 0 0 0 Pack Horses
P007070 8192 64 0 0 0 0 Artillery Limbers
P007071 8192 64 0 0 0 0 Artillery Limbers
P007072 8192 64 0 0 0 0 Artillery Limbers
P007073 8192 64 0 0 0 0 Artillery Limbers
P137035 8192 32 0 64 0 0 Wagons
P137036 8192 32 0 64 0 0 Wagons
P137037 8192 32 0 64 0 0 Wagons
P137038 8192 32 0 64 0 0 Wagons
P217026 8192 32 0 64 0 0 VM Wagons
P217027 8192 32 0 64 0 0 VM Wagons
P217028 8192 32 0 64 0 0 VM Wagons
P217029 8192 32 0 64 0 0 VM Wagons
P217087 8192 32 0 64 0 0 Wagons
P217088 8192 32 0 64 0 0 Wagons
P217089 8192 32 0 64 0 0 Wagons
P217090 8192 32 0 64 0 0 Wagons
P497043 8192 32 0 64 0 0 Wagons
P497044 8192 32 0 64 0 0 Wagons
P497045 8192 32 0 64 0 0 Wagons
P497046 8192 32 0 64 0 0 Wagons
P507061 8192 32 0 64 0 0 Wagons
P507062 8192 32 0 64 0 0 Wagons
P507063 8192 32 0 64 0 0 Wagons
P507064 8192 32 0 64 0 0 Wagons



By default, the output shows the platoon ID#, all six of its flag values, and the unit name. The ID# and flag values always show, but by specifying -short and/or -nick you can show also the unit short names or nicknames if you wish.

The first listed flag value is a move flag. Every one of those move flags is 8192. Let's use csflags.pl to verify:



rober@Rob10rto ~/cslint
$ ./csflags.pl -g vn -move 8192
XWagon



Yes, seems to be correct.

For Vietnam, let's see all amphibious units:



rober@Rob10rto ~/cslint
$ ./csflgrpt.pl -g vn -move XAmphibious
P000046 161 16 1 92 2097167 0 PT-76 Light Tank
P000047 161 16 1 92 2097167 0 PT-76 Light Tank
P000048 161 16 1 92 2097167 0 PT-76 Light Tank
P000049 161 16 1 92 2097167 0 PT-76 Light Tank
P000052 161 16 1 92 2097167 0 Type 63 (Amph Light Tank)
P007007 161 8 3 72 24 0 Type 63C APC
P007008 161 8 3 72 24 0 Type 63C APC
P007009 161 8 3 72 24 0 Type 63C APC
P007010 161 8 257 72 2097167 0 Type 86 IFV
P007011 161 8 257 72 2097167 0 Type 86 IFV
[... output omitted for brevity ...]
P507012 161 32 1 72 24 0 M577
P507013 161 32 1 72 24 0 M577
P506810 161 8 35 264 0 0 LVTP-7
P506811 161 8 35 264 0 0 LVTP-7
P506812 161 8 35 264 0 0 LVTP-7
P506813 161 8 35 264 0 0 LVTP-7
P503009 161 0 1 0 4194304 0 Regimental HQ (arm.)
P503010 161 0 0 0 4194304 0 Regimental HQ (arm.)
P503013 161 0 1 4194304 4194304 0 Battalion HQ (arm.)
P503014 161 0 0 0 4194304 0 Battalion HQ (arm.)



Lots and lots of amphibious units. You could output that to the 'less' command.



rober@Rob10rto ~/cslint
$ ./csflgrpt.pl -g vn -move XAmphibious | less



Remember too that by piping output to the egrep command, you can filter out subsets. For example, let's see all CSVN amphibious engineer units:



rober@Rob10rto ~/cslint
$ ./csflgrpt.pl -g vn -move XAmphibious | egrep -i "engineer"
P106806 161 8 1 1155 24 0 LVTE-1 Engineer Vehicle
P107587 161 8 1 4211149 24 0 LVTE-1 Engineer Vehicle



Let's find the Spooky's:



rober@Rob10rto ~/cslint
$ ./csflgrpt.pl -g vn -move XAir | egrep -i "spooky"
[nil]



Oh! There don't seem to be any. But there are. In addition to the default name, let's also specify showing the short and nick(name) designations:



rober@Rob10rto ~/cslint
$ ./csflgrpt.pl -g vn -move XAir -name -short -nick | egrep -i "spooky"
P106571 65536 0 16896 134225920 16400 0 AC47 Gunship AC47 Gunship Spooky
P496503 65536 0 16904 8200 16400 0 AC47 Gunship AC47 Gunship Spooky



When using 'egrep' to search for (name match) unit designations, it is usually best to specify all of: -name -short -nick

How about low-flying aircraft with napalm as ordnance.



rober@Rob10rto ~/cslint
$ ./csflgrpt.pl -g vn -other XLowFlying | egrep -i napalm
P105131 65536 0 0 70254592 0 16 Grumman F7F Tigercat {Napalm}
P105061 65536 0 0 51380224 0 16 Douglas B-26C Invader {Napalm}
P105064 65536 0 0 103809024 0 16 Douglas A-1 Skyraider {Napalm}
P105019 65536 0 0 45088768 0 16 Republic F-84 Thunderjet {Napalm}
P105069 65536 0 0 45088768 0 16 Northrop F-5 E/F {Napalm}
P105070 65536 0 0 112197632 0 16 Vought F-8 Crusader {Napalm}
P105106 65536 0 0 112197632 0 16 Douglas A-4F Skyhawk {Napalm}
P105078 65536 0 0 112197632 0 16 Grumman A-6 Intruder {Napalm}
P105081 65536 0 0 112197632 0 16 LTV A-7 Corsair II {Napalm}
P105088 65536 0 0 45088768 0 16 McDonnell Douglas AV-8 Harrier {Napalm}
P105092 65536 0 0 45088768 0 16 USN McDonnell Douglas F-4B Phantom II {Napalm}
P105094 65536 0 0 45088768 0 16 USAF McDonnell Douglas F-4C Phantom II {Napalm}
P105095 65536 0 0 45088768 0 16 USAF McDonnell Douglas F-4D Phantom II {Napalm}
P105044 65536 0 0 45088768 0 16 USAF McDonnell Douglas F-4E Phantom II {Napalm}
P105098 65536 0 0 45088768 0 16 USAF McDonnell Douglas F-4N Phantom {Napalm}
P105100 65536 0 0 45088768 0 16 USMC McDonnell Douglas F-4S Phantom {Napalm}
P105051 65536 0 0 45088768 0 46 General Dynamics F-16 Fighting Falcon {Napalm}
P105109 65536 0 0 103809024 0 16 Douglas A-1 Skyraider {Napalm}
P105116 65536 0 0 112197632 0 16 Grumman A-6 Intruder {Napalm}
P105119 65536 0 0 45088768 0 16 USN McDonnell Douglas F-4B Phantom II {Napalm}
P105121 65536 0 0 45088768 0 16 USAF McDonnell Douglas F-4N Phantom {Napalm}
P105123 65536 0 0 45088768 0 16 USMC McDonnell Douglas F-4S Phantom {Napalm}
P105125 65536 0 0 45088768 0 16 McDonnell Douglas AV-8 Harrier {Napalm}
P105127 65536 0 0 112197632 0 16 Vought F-8 Crusader {Napalm}
P115003 65536 0 0 103809024 0 16 Douglas A-1 Skyraider {Napalm}
P115006 65536 0 0 11534336 0 16 Northrop F-5 E/F {Napalm}
P115009 65536 0 0 11534336 0 16 Cessna A-37 Dragonfly {Napalm}
P125006 65536 0 0 112197632 0 16 McDonnell Douglas F-4E Phantom II {Napalm}



Interesting fact: For aircraft units, their primary ordnance is embedded in the unit name, at the end, enclosed by curly braces { and }. Note that aircraft might have additional secondary (and tertiary...) ordnance also, although not indicated in the unit name.

It seems that all of the low-flying aircraft have napalm as ordnance. Let's try a command to check for napalm formally:



rober@Rob10rto ~/cslint
$ ./csflgrpt.pl -g vn -morefire XNapalm
P085033 65536 0 0 36175872 0 16 Douglas B-26C Invader {Napalm}
P105131 65536 0 0 70254592 0 16 Grumman F7F Tigercat {Napalm}
P105061 65536 0 0 51380224 0 16 Douglas B-26C Invader {Napalm}
P105064 65536 0 0 103809024 0 16 Douglas A-1 Skyraider {Napalm}
P105019 65536 0 0 45088768 0 16 Republic F-84 Thunderjet {Napalm}
P105069 65536 0 0 45088768 0 16 Northrop F-5 E/F {Napalm}
P105070 65536 0 0 112197632 0 16 Vought F-8 Crusader {Napalm}
P105106 65536 0 0 112197632 0 16 Douglas A-4F Skyhawk {Napalm}
P105078 65536 0 0 112197632 0 16 Grumman A-6 Intruder {Napalm}
P105081 65536 0 0 112197632 0 16 LTV A-7 Corsair II {Napalm}
P105088 65536 0 0 45088768 0 16 McDonnell Douglas AV-8 Harrier {Napalm}
P105092 65536 0 0 45088768 0 16 USN McDonnell Douglas F-4B Phantom II {Napalm}
P105094 65536 0 0 45088768 0 16 USAF McDonnell Douglas F-4C Phantom II {Napalm}
P105095 65536 0 0 45088768 0 16 USAF McDonnell Douglas F-4D Phantom II {Napalm}
P105044 65536 0 0 45088768 0 16 USAF McDonnell Douglas F-4E Phantom II {Napalm}
P105098 65536 0 0 45088768 0 16 USAF McDonnell Douglas F-4N Phantom {Napalm}
P105100 65536 0 0 45088768 0 16 USMC McDonnell Douglas F-4S Phantom {Napalm}
P105109 65536 0 0 103809024 0 16 Douglas A-1 Skyraider {Napalm}
P105116 65536 0 0 112197632 0 16 Grumman A-6 Intruder {Napalm}
P105119 65536 0 0 45088768 0 16 USN McDonnell Douglas F-4B Phantom II {Napalm}
P105121 65536 0 0 45088768 0 16 USAF McDonnell Douglas F-4N Phantom {Napalm}
P105123 65536 0 0 45088768 0 16 USMC McDonnell Douglas F-4S Phantom {Napalm}
P105125 65536 0 0 45088768 0 16 McDonnell Douglas AV-8 Harrier {Napalm}
P105127 65536 0 0 112197632 0 16 Vought F-8 Crusader {Napalm}
P115003 65536 0 0 103809024 0 16 Douglas A-1 Skyraider {Napalm}
P115006 65536 0 0 11534336 0 16 Northrop F-5 E/F {Napalm}
P115009 65536 0 0 11534336 0 16 Cessna A-37 Dragonfly {Napalm}
P125006 65536 0 0 112197632 0 16 McDonnell Douglas F-4E Phantom II {Napalm}



It seems that all low-flying aircraft use napalm as ordnance, that the two preceding lists are the same. But are they? Let's use some advanced Linux techniques to make sure.

For both of the above commands, we sort their output and capture to a temporary file:



rober@Rob10rto ~/cslint
$ ./csflgrpt.pl -g vn -other XLowFlying | egrep -i napalm | sort > /cygdrive/c/Temp/junk600

rober@Rob10rto ~/cslint
$ ./csflgrpt.pl -g vn -morefire XNapalm | sort > /cygdrive/c/Temp/junk601



I won't explain the ins & outs of this wizardry here, in this post showcasing the csflgrpt.pl utility. For more about Linux wizardry, see: https://www.howtogeek.com/412055/37-imp ... ould-know/

Using the Linux 'diff' command, let's check for any differences between those two temp files:



rober@Rob10rto ~/cslint
$ diff /cygdrive/c/Temp/junk600 /cygdrive/c/Temp/junk601
0a1
> P085033 65536 0 0 36175872 0 16 Douglas B-26C Invader {Napalm}
3d3
< P105051 65536 0 0 45088768 0 46 General Dynamics F-16 Fighting Falcon {Napalm}



Oh! What do you know? They differ. Using csflags.pl (see the earlier post), we check the morefire and other flags for those two units:



rober@Rob10rto ~/cslint
$ ./csflags.pl -g vn -morefire 16
XNapalm

rober@Rob10rto ~/cslint
$ ./csflags.pl -g vn -morefire 46
XRockets/XBombs/XBombsII/XSmartMunitions

rober@Rob10rto ~/cslint
$ ./csflags.pl -g vn -other 36175872
XHighFlying/XBomber/XFAC

rober@Rob10rto ~/cslint
$ ./csflags.pl -g vn -other 45088768
XLowFlying/XBomber/XFastMover/XFAC



We have discovered another mistake! For the unit



P105051 65536 0 0 45088768 0 46 General Dynamics F-16 Fighting Falcon {Napalm}



despite the unit name including '{Napalm}', in fact it lacks the XNapalm morefire attribute



XRockets/XBombs/XBombsII/XSmartMunitions



And note that the unit



P085033 65536 0 0 36175872 0 16 Douglas B-26C Invader {Napalm}



is not low-flying



XHighFlying/XBomber/XFAC



Are these two units mistakenly specified? Should the Douglas B-26C Invader be specified as XLowFlying? Should the General Dynamics F-16 Fighting Falcon be given the XNapalm attribute? We should reconsider it!

This is another example of how we can use CSlint not only to data mine but also to QA the data, to go looking for mistakes.

We can combine attribute flags, showing units with a combination of capabilities, for example:



rober@Rob10rto ~/cslint
$ ./csflgrpt.pl -g vn -morefire XNapalm -other XHighFlying
P085033 65536 0 0 36175872 0 16 Douglas B-26C Invader {Napalm}



Ah! We have just verified anew that the Douglas B-26C Invader is a high-flying, napalm-armed aircraft.

We list the gunship units:



rober@Rob10rto ~/cslint
$ ./csflgrpt.pl -g vn -fire XGunship
P086505 65536 32 512 4096 262160 0 Piasecki H-21C Gunship
P086507 65536 0 512 4096 262160 0 Bell 47 Gunship
P086510 65536 0 512 4096 262160 0 Sikorsky H-34 Gunship ▒Pirate▒
P086512 65536 0 512 4096 262160 0 Sikorsky H-19 Chickasaw Gunship
P086514 65536 0 512 4096 262160 0 SA-313B Alouette II Gunship
P086528 65536 0 512 4096 262160 0 SA-316 Alouette III Gunship
P086520 65536 0 512 4096 262160 0 SA-341 Gazelle
P106571 65536 0 16896 134225920 16400 0 AC47 Gunship
P106572 65536 0 16896 134225920 16400 0 AC130H Gunship
P106573 65536 0 16896 134225920 16400 0 AC119G Gunship
P106574 65536 0 16896 134225920 16400 0 AC119K Gunship
P116501 65536 0 16904 134225920 16400 0 AC47 Gunship
P138014 2 131 10960 0 1048600 0 SA-7 Grail MANPAD
P496503 65536 0 16904 8200 16400 0 AC47 Gunship
P496512 65536 8 512 4096 262160 0 Mi-24 Hind D Gunship
P506517 65536 0 16904 8200 16400 0 Cargo Type 2



(Hmm. That SA-7 Grail MANPAD mention. Is that another data mistake?)

The list of helicopter gunship units:



rober@Rob10rto ~/cslint
$ ./csflgrpt.pl -g vn -fire XGunship -other XHelicopter
P086505 65536 32 512 4096 262160 0 Piasecki H-21C Gunship
P086507 65536 0 512 4096 262160 0 Bell 47 Gunship
P086510 65536 0 512 4096 262160 0 Sikorsky H-34 Gunship ▒Pirate▒
P086512 65536 0 512 4096 262160 0 Sikorsky H-19 Chickasaw Gunship
P086514 65536 0 512 4096 262160 0 SA-313B Alouette II Gunship
P086528 65536 0 512 4096 262160 0 SA-316 Alouette III Gunship
P086520 65536 0 512 4096 262160 0 SA-341 Gazelle
P496512 65536 8 512 4096 262160 0 Mi-24 Hind D Gunship



Note that the fixed-wing aircraft (also the MANPAD) are excluded from that list.

It's perfectly possible that no units yet have a given attribute. Let's see if there are any units in CSVN with XChemical capability:



rober@Rob10rto ~/cslint
$ ./csflgrpt.pl -g vn -morefire XChemical
[nil]



No output (nil), so as of yet, there are none. (XChemical refers to anti-personnel chemical attacks, not to defoliation.)

Of course it is possible to combine attributes yielding no matches, for example:



rober@Rob10rto ~/cslint
$ ./csflgrpt.pl -g vn -move XTunnel -other XHelicopter
[nil]



No surprise, that.

You will see many other examples of csflgrpt.pl usage in this and other threads (including further explanation of using other WSL Linux tools). But the above should be enough to get you started.

If you have questions, just ask here in the Forum.

Good luck! Happy data mining! Happy parameter tweaking/fixing!
Campaign Series Legion https://cslegion.com/
Campaign Series Lead Coder https://www.matrixgames.com/forums/view ... hp?f=10167
Panzer Campaigns, Panzer Battles Lead Coder https://wargameds.com
User avatar
berto
Posts: 21461
Joined: Wed Mar 13, 2002 1:15 am
Location: metro Chicago, Illinois, USA
Contact:

Re: CSlint How-To

Post by berto »

csrptflags.pl


csrptflags.pl is a Perl script (program) to report all unit flags.

(Note: In the course of preparing this, we implemented some extensions not available in the current public CSlint release. The updated csrptflags.pl will be included in CSVN v1.20 and later. Until then, if you try the exercises following, your results might vary.)

Start by displaying the program help:



rober@Rob10rto ~/cslint
$ ./csrptflags.pl -h -g vn

Usage: csrptflags.pl [-h|-help] [{+|-}i|{+|-}insensitive] [{+|-}G|-debug] -g[ame] {me|vn|cw|ef|wf|pf} [{-name|-short|-nick}] [-m "<string>"|-match "<string>"]



For Middle East, let's see all unit flags for camels:



rober@Rob10rto ~/cslint
$ ./csrptflags.pl -g me -m "camel"
P237081 2048 8192 0 64 0 0 Camel
move: XHorse
carry: XCarryHorse
fire:
other: XRetreatAI
more:
morefire:



On the first line of output, you will see the unit's platoon ID#; the move, carry, fire, other, more & morefire flags, all as number values; and by default the long form of the unit name.

On the following lines of output, you will see those numbers translated to their verbal designations.

Let's see all unit flags for horses:



rober@Rob10rto ~/cslint
$ ./csrptflags.pl -g me -m "horse"
P087062 2048 8192 0 0 0 0 Horses
move: XHorse
carry: XCarryHorse
fire:
other:
more:
morefire:

P087063 2048 8192 0 0 0 0 Horses
move: XHorse
carry: XCarryHorse
fire:
other:
more:
morefire:

P086504 65536 8 0 4096 24 0 Piasecki H-21 Shawnee/ Workhorse
move: XAir
carry: XCarryAll
fire:
other: XHelicopter
more: XInfSup/XFireHelo
morefire:

P086522 65536 8 0 4096 24 0 Piasecki H-21 Shawnee/ Workhorse
move: XAir
carry: XCarryAll
fire:
other: XHelicopter
more: XInfSup/XFireHelo
morefire:

P086523 65536 8 0 4096 24 0 Piasecki H-21 Shawnee/ Workhorse
move: XAir
carry: XCarryAll
fire:
other: XHelicopter
more: XInfSup/XFireHelo
morefire:


P147035 2048 8 0 0 0 0 Horses
move: XHorse
carry: XCarryAll
fire:
other:
more:
morefire:

P147036 2048 8192 0 0 0 0 Horses
move: XHorse
carry: XCarryHorse
fire:
other:
more:
morefire:

P147037 2048 8192 0 0 0 0 Horses
move: XHorse
carry: XCarryHorse
fire:
other:
more:
morefire:

P287032 2048 8192 0 0 0 0 Horses
move: XHorse
carry: XCarryHorse
fire:
other:
more:
morefire:

P287033 2048 8192 0 0 0 0 Horses
move: XHorse
carry: XCarryHorse
fire:
other:
more:
morefire:

P287034 2048 8192 0 0 0 0 Horses
move: XHorse
carry: XCarryHorse
fire:
other:
more:
morefire:



Note that those are "horse" of all nations (in the game CSME).

But wait! Those third, fourth & fifth units aren't really horses. But they match because they have "horse" in their name, and by default the program does case insensitive matches. What if we truly just want to see actual horse units? In that case, we can specify case sensitivity in the match by means of the -i (no insensitivity) flag, and by capitalizing the match string:



rober@Rob10rto ~/cslint
$ ./csrptflags.pl -g me -i -m "Horse"
P087062 2048 8192 0 0 0 0 Horses
move: XHorse
carry: XCarryHorse
fire:
other:
more:
morefire:

P087063 2048 8192 0 0 0 0 Horses
move: XHorse
carry: XCarryHorse
fire:
other:
more:
morefire:

P147035 2048 8 0 0 0 0 Horses
move: XHorse
carry: XCarryAll
fire:
other:
more:
morefire:

P147036 2048 8192 0 0 0 0 Horses
move: XHorse
carry: XCarryHorse
fire:
other:
more:
morefire:

P147037 2048 8192 0 0 0 0 Horses
move: XHorse
carry: XCarryHorse
fire:
other:
more:
morefire:

P287032 2048 8192 0 0 0 0 Horses
move: XHorse
carry: XCarryHorse
fire:
other:
more:
morefire:

P287033 2048 8192 0 0 0 0 Horses
move: XHorse
carry: XCarryHorse
fire:
other:
more:
morefire:

P287034 2048 8192 0 0 0 0 Horses
move: XHorse
carry: XCarryHorse
fire:
other:
more:
morefire:



What if we want to see unit flags for both camels and horses? We do it by including both those words in the match string, separated by the | (or) symbol:



rober@Rob10rto ~/cslint
$ ./csrptflags.pl -g me -i -m "Camel|Horse"
P087062 2048 8192 0 0 0 0 Horses
move: XHorse
carry: XCarryHorse
fire:
other:
more:
morefire:

P087063 2048 8192 0 0 0 0 Horses
move: XHorse
carry: XCarryHorse
fire:
other:
more:
morefire:

P147035 2048 8 0 0 0 0 Horses
move: XHorse
carry: XCarryAll
fire:
other:
more:
morefire:

P147036 2048 8192 0 0 0 0 Horses
move: XHorse
carry: XCarryHorse
fire:
other:
more:
morefire:

P147037 2048 8192 0 0 0 0 Horses
move: XHorse
carry: XCarryHorse
fire:
other:
more:
morefire:

P237081 2048 8192 0 64 0 0 Camel
move: XHorse
carry: XCarryHorse
fire:
other: XRetreatAI
more:
morefire:

P287032 2048 8192 0 0 0 0 Horses
move: XHorse
carry: XCarryHorse
fire:
other:
more:
morefire:

P287033 2048 8192 0 0 0 0 Horses
move: XHorse
carry: XCarryHorse
fire:
other:
more:
morefire:

P287034 2048 8192 0 0 0 0 Horses
move: XHorse
carry: XCarryHorse
fire:
other:
more:
morefire:



Turning now to the Vietnam game, let's see the unit flags for AC47 Gunship "Spooky":



rober@Rob10rto ~/cslint
$ ./csrptflags.pl -g vn +i -m "spooky"
P106571 65536 0 16896 134225920 16400 0 AC47 Gunship
move: XAir
carry:
fire: XGunship/XFFATG
other: XOnBoardAirPlane/XLoiter
more: XFireHelo/XNightVision
morefire:

P496503 65536 0 16904 8200 16400 0 AC47 Gunship
move: XAir
carry:
fire: XIndirectFire/XGunship/XFFATG
other: XFireSoftAI/XOnBoardAirPlane
more: XFireHelo/XNightVision
morefire:



Note the use of '+i', to turn ON case insensitivity.

By a strange quirk of programming, we see the unit flags for all Spooky, but we don't see any "Spooky" in the output. In order to see that, we need to specify -name, -short and/or -nick:



rober@Rob10rto ~/cslint
$ ./csrptflags.pl -g vn +i -name -short -nick -m "spooky"
P106571 65536 0 16896 134225920 16400 0 AC47 Gunship AC47 Gunship Spooky
move: XAir
carry:
fire: XGunship/XFFATG
other: XOnBoardAirPlane/XLoiter
more: XFireHelo/XNightVision
morefire:

P496503 65536 0 16904 8200 16400 0 AC47 Gunship AC47 Gunship Spooky
move: XAir
carry:
fire: XIndirectFire/XGunship/XFFATG
other: XFireSoftAI/XOnBoardAirPlane
more: XFireHelo/XNightVision
morefire:



Let's take a look at all howitzer units:



rober@Rob10rto ~/cslint
$ ./csrptflags.pl -g vn -name -short -nick -m "howitzer"
P001021 2 4 24 8 2228232 0 PLA M1A1 75mm Pack 75
move: XFoot
carry: XTowable
fire: XIndirectFire/XSmokeFiring
other: XFireSoftAI
more: XInfSup/XArtyAmmo/XNoFireHelo
morefire:

P001022 0 4 24 8 2228232 0 PLA M2A1 105mm One-Oh-Five
move:
carry: XTowable
fire: XIndirectFire/XSmokeFiring
other: XFireSoftAI
more: XInfSup/XArtyAmmo/XNoFireHelo
morefire:

P001023 0 4100 24 8 2228232 0 PLA 122mm How 122-10/30
move:
carry: XTowable/XHeavyGun
fire: XIndirectFire/XSmokeFiring
other: XFireSoftAI
more: XInfSup/XArtyAmmo/XNoFireHelo
morefire:

P001024 0 4100 24 8 2228232 0 Type 54 122mm How Type 54
move:
carry: XTowable/XHeavyGun
fire: XIndirectFire/XSmokeFiring
other: XFireSoftAI
more: XInfSup/XArtyAmmo/XNoFireHelo
morefire:

P001025 0 4100 8 8 2228232 0 PLA 120mm How Type 38
move:
carry: XTowable/XHeavyGun
fire: XIndirectFire
other: XFireSoftAI
more: XInfSup/XArtyAmmo/XNoFireHelo
morefire:

[... output omitted for brevity ...]



Since for many unit match specifications the output will be quite voluminous, you will often want to redirect output to the 'less' command:



rober@Rob10rto ~/cslint
$ ./csrptflags.pl -g vn -name -short -nick -m "howitzer" | less



Following are the unit flags of commanders, with such units indicated in their unit names. (WARNING! Since the output will be quite lengthy, you might want to pipe through the 'less' command.)



rober@Rob10rto ~/cslint
$ ./csrptflags.pl -g vn -m "commander"
P004101 2 3 0 0 0 0 Commander 1
move: XFoot
carry: XLoadable/XRidable
fire:
other:
more:
morefire:

P004102 2 3 0 0 0 0 Commander 2
move: XFoot
carry: XLoadable/XRidable
fire:
other:
more:
morefire:

P004103 2 3 0 0 0 0 Commander 3
move: XFoot
carry: XLoadable/XRidable
fire:
other:
more:
morefire:

P004104 2 3 0 0 0 0 Commander 4
move: XFoot
carry: XLoadable/XRidable
fire:
other:
more:
morefire:

P004105 2 3 0 0 0 0 Commander 5
move: XFoot
carry: XLoadable/XRidable
fire:
other:
more:
morefire:

[... output omitted for brevity ...]



Here is another way to show the unit flags for commanders:



rober@Rob10rto ~/cslint
$ ./csrptflags.pl -g vn -m "P[[:digit:]]{2}4[0-5][[:digit:]]{2}"
P004101 2 3 0 0 0 0 Commander 1
move: XFoot
carry: XLoadable/XRidable
fire:
other:
more:
morefire:

P004102 2 3 0 0 0 0 Commander 2
move: XFoot
carry: XLoadable/XRidable
fire:
other:
more:
morefire:

P004103 2 3 0 0 0 0 Commander 3
move: XFoot
carry: XLoadable/XRidable
fire:
other:
more:
morefire:

P004104 2 3 0 0 0 0 Commander 4
move: XFoot
carry: XLoadable/XRidable
fire:
other:
more:
morefire:

P004105 2 3 0 0 0 0 Commander 5
move: XFoot
carry: XLoadable/XRidable
fire:
other:
more:
morefire:

[... output omitted for brevity ...]



The "P[[:digit:]]{2}4[0-5][[:digit:]]{2}" -- what's that all about?

That is an example of a "regular expression" pattern match string.
  • P[[:digit:]]{2} -- says to match P followed by 2 digits
  • 4[0-5] -- says to match 4 followed by any digit from 0 through 5
  • [[:digit:]]{2} -- says to match 2 digits
Why that? Here are the game's platoon codes:



PXX0001 – PXX0999 Tanks, Light Tanks, Self-propelled Gun (as SU-100)
PXX1001 – PXX1999 Artillery (Self-propelled and towed)
PXX2001 – PXX2999 Infantry (All types)
PXX3001 – PXX3199 Headquarters (All types)
PXX3200 - PXX3999 Spare
PXX4001 – PXX4010 Leaders (All types) - Foot the firt 5 ID's, motorized the last 5 ID's.
PXX4101 – PXX4110 Leaders (All types) - Different branch: Foot the firt 5 ID's, motorized the last 5 ID's.
PXX4201 – PXX4210 Leaders (All types) - Different branch: Foot the firt 5 ID's, motorized the last 5 ID's.
PXX4301 – PXX4310 Leaders (All types) - Different branch: Foot the firt 5 ID's, motorized the last 5 ID's.
PXX4401 – PXX4410 Leaders (All types) - Different branch: Foot the firt 5 ID's, motorized the last 5 ID's.
PXX4501 – PXX4510 Leaders (All types) - Different branch: Foot the firt 5 ID's, motorized the last 5 ID's.

PXX4600 - PXX4999 Spare
PXX5001 – PXX5999 Off-map Airplanes (All types)
PXX6001 – PXX6499 Reconnaissance Vehicles (Armoured Cars, Recce Jeeps, etc)
PXX6500 – PXX6799 Helicopters and ON MAP aircraft (All types)
PXX6800 – PXX6999 Naval Units (Boats, Landing Craft, etc)
PXX7001 – PXX7999 Transport units (All types of Trucks, APC’s, IFV’s, etc)
PXX8001 – PXX8499 Antiaircraft (Self-propelled, towed, man portable)
PXX8500 – PXX8799 Rail
PXX8800 – PXX8999 Misc Buildings, special units (Factories, News Crews, etc)
PXX9001 – PXX9499 Antitank (Self-propelled, towed, man portable)
PXX9500 – PXX9999 Spare



If you study the example, you can probably figure out how to match the other unit categories.

This will show you all tanks etc.:



rober@Rob10rto ~/cslint
$ ./csrptflags.pl -g vn -m "P[[:digit:]]{2}0[[:digit:]]{3}"
P000001 33 16 1 4 2097167 0 M4 Medium Tanks
move: XTracked/XNoLtBridge
carry: XCarryRider
fire: XHardTarget
other: XFireHardAI
more: XAssault/XOffAT/XDefAT/XInfSup/XNoFireHelo
morefire:

P000002 33 16 1 4 2097167 0 M4 Medium Tanks
move: XTracked/XNoLtBridge
carry: XCarryRider
fire: XHardTarget
other: XFireHardAI
more: XAssault/XOffAT/XDefAT/XInfSup/XNoFireHelo
morefire:

P000003 33 16 1 4 2097167 0 M4 Medium Tanks
move: XTracked/XNoLtBridge
carry: XCarryRider
fire: XHardTarget
other: XFireHardAI
more: XAssault/XOffAT/XDefAT/XInfSup/XNoFireHelo
morefire:

P000004 33 16 1 4 2097167 0 Type 97 CHI-HA Kai Medium Tanks
move: XTracked/XNoLtBridge
carry: XCarryRider
fire: XHardTarget
other: XFireHardAI
more: XAssault/XOffAT/XDefAT/XInfSup/XNoFireHelo
morefire:

P000005 33 16 1 4 2097167 0 Type 97 CHI-HA Kai Medium Tanks
move: XTracked/XNoLtBridge
carry: XCarryRider
fire: XHardTarget
other: XFireHardAI
more: XAssault/XOffAT/XDefAT/XInfSup/XNoFireHelo
morefire:

[... output omitted for brevity ...]



Note the subtle differences between the Leader case and the Tanks case.

What if you want to review all unit flags? In that case, just omit the -m "<match>". (WARNING! The following command will take a very long time, so maybe go out for a walk?)



rober@Rob10rto ~/cslint
$ time ./csrptflags.pl -g vn > csrptflags.vn.out

real 25m7.333s
user 7m33.144s
sys 13m39.893s



Wow! More than 25 minutes to process the CSVN game unit data!

Note how, by means of the '> csrptflags.vn.out' I captured the program output to a file by that name.

Why you would want to capture to a file:
  • The output, for all units, is very long, way too long to see in your terminal window.
  • Displaying unit flags can take a good long while.
  • You should only have to do this once. Thereafter, you can search for things in the csrptflags.vn.out file (using your favorite file viewer or editor).
You can capture unit flag output to any file you wish, for example: csrptflags.horses.me.out, csrptflags.howitzers.vn.out, etc. But you will probably always want to capture all units flags to a file. It is too impractical not to.

If you want to refer to that file in Windows, not in WSL Linux (or Cygwin), using your favorite Windows editor, you might need to pipe the output through the Linux-to-Windows text converter, as in:



rober@Rob10rto ~/cslint
$ ./csrptflags.pl -g vn | ./unix2dos > csrptflags.vn.out



Or if you already have a csrptflags.vn.out, you could do this



rober@Rob10rto ~/cslint
$ ./unix2dos < csrptflags.vn.out > csrptflags.vn.txt



Or this:



rober@Rob10rto ~/cslint
$ cat csrptflags.vn.out | ./unix2dos > csrptflags.vn.txt



You will see many other examples of csrptflags.pl usage in this and other threads (including further explanation of using other WSL Linux tools). But the above should be enough to get you started.

If you have questions, just ask here in the Forum.

Good luck! Happy data mining!
Campaign Series Legion https://cslegion.com/
Campaign Series Lead Coder https://www.matrixgames.com/forums/view ... hp?f=10167
Panzer Campaigns, Panzer Battles Lead Coder https://wargameds.com
User avatar
berto
Posts: 21461
Joined: Wed Mar 13, 2002 1:15 am
Location: metro Chicago, Illinois, USA
Contact:

Re: CSlint How-To

Post by berto »

csaiprpt.pl


csaiprpt.pl is a Perl script (program) to report AAI (so-called Adaptive AI) parameters in the .ai files.

(Note: In the course of preparing this, we implemented some fixes not available in the current public CSlint release. The updated csaiprpt.pl will be included in CSVN v1.20 and later. Until then, if you try the exercises following, your results might vary.)

Start by displaying the program help:



rober@Rob10rto ~/cslint
$ ./csaiprpt.pl -h

Usage: csaiprpt.pl [-h|-help] [{+|-}G|-debug] -g[ame] {me|vn|cw|ef|wf|pf} [{+|-}F|{+|-}show_files] [{+|-}N|{+|-}show_linenos] [-defaults] [-have] [-side] [-nation] [<parameters list>|-ALL] [-f <filename>]

parameters list:
-0 or -hot_max
-1 or -hot_trigger
-2 or -move_trigger_AttackStrong
-3 or -move_trigger_AttackWeak
-4 or -move_trigger_NoOrder
-5 or -move_trigger_DefendStrong
-6 or -move_trigger_DefendWeak
-7 or -move_trigger_doubletime
-8 or -move_doubletime_prob
-9 or -move_armor_standoff_prob
-10 or -move_runaway_prob
-11 or -move_leaderhq_runaway_prob
-12 or -move_takecover_prob
-13 or -move_bailout_prob
-14 or -move_exitmap_prob
-15 or -move_unload_prob
-16 or -move_cavejump_prob
-17 or -move_reinforce_bunker_prob
-18 or -unload
-19 or -standoff
-20 or -move_reserved_20
-21 or -move_reserved_21
-22 or -move_reserved_22
-23 or -move_reserved_23
-24 or -move_reserved_24
-25 or -move_reserved_25
-26 or -move_reserved_26
-27 or -move_reserved_27
-28 or -move_reserved_28
-29 or -move_reserved_29
-30 or -oplimit_tankfiring_hardtarget
-31 or -oplimit_tankfiring_softtarget
-32 or -oplimit_tankfiring_helotarget
-33 or -oplimit_tankfiring_othertarget
-34 or -oplimit_atfiring_hardtarget
-35 or -oplimit_atfiring_softtarget
-36 or -oplimit_atfiring_helotarget
-37 or -oplimit_atfiring_othertarget
-38 or -oplimit_aaafiring_hardtarget
-39 or -oplimit_aaafiring_softtarget
-40 or -oplimit_aaafiring_helotarget
-41 or -oplimit_aaafiring_othertarget
-42 or -oplimit_otherfiring_hardtarget
-43 or -oplimit_otherfiring_softtarget
-44 or -oplimit_otherfiring_helotarget
-45 or -oplimit_otherfiring_othertarget
-46 or -oplimit_reserved_46
-47 or -oplimit_reserved_47
-48 or -oplimit_reserved_48
-49 or -oplimit_reserved_49
-50 or -max_hex_if_attacks
-51 or -if_hardtarget_kill_prob
-52 or -blind_fire_prob
-53 or -if_moving_nonvehicle_target_hex_change_prob
-54 or -if_moving_vehicle_target_hex_change_prob
-51 or -if_spotted_scatter_prob
-56 or -if_unspotted_scatter_prob
-57 or -if_spotted_scatters
-58 or -if_unspotted_scatters
-59 or -if_obstructed_fire_capable
-60 or -leader_loss_prob
-61 or -fire_starshell_prob
-62 or -starshell_scatter_prob
-63 or -fire_smoke_prob
-64 or -banzai_prob
-65 or -direct_fire_at_civilians_prob
-66 or -fire_density_effect
-67 or -indirect_fire_at_civilians_prob
-68 or -indirect_fire_denied_prob
-69 or -combat_reserved_69
-70 or -fatigue_prob
-71 or -recover_from_fatigue_prob
-72 or -lose_morale_prob
-73 or -recover_morale_prob
-74 or -disrupt_prob
-75 or -undisrupt_prob
-76 or -morale_shift
-77 or -status_reserved_77
-78 or -status_reserved_78
-79 or -status_reserved_79
-80 or -atg_move_reveal_prob
-81 or -atg_fire_reveal_prob
-82 or -sneaker_move_reveal_prob
-83 or -sneaker_fire_reveal_prob
-84 or -vehicle_move_reveal_prob
-85 or -vehicle_fire_reveal_prob
-86 or -nonvehicle_move_reveal_prob
-87 or -nonvehicle_fire_reveal_prob
-88 or -concealment_reserved_88
-89 or -concealment_reserved_89
-90 or -supply_radius_modifier
-91 or -low_on_ammo_prob
-92 or -out_of_ammo_prob
-93 or -supply_reserved_93
-94 or -supply_reserved_94
-95 or -supply_reserved_95
-96 or -supply_reserved_96
-97 or -supply_reserved_97
-98 or -supply_reserved_98
-99 or -supply_reserved_99
-100 or -activity_reserved_100
-101 or -activity_reserved_101
-102 or -fortify_prob
-103 or -dig_prob
-104 or -build_light_bridge_prob
-105 or -build_vehicle_bridge_prob
-106 or -lay_minefield_prob
-107 or -set_ied_prob
-108 or -build_barrier_prob
-109 or -activity_reserved_109
-110 or -bad_health
-111 or -good_health
-112 or -cave_capable
-113 or -banzai_capable
-114 or -unit_color
-115 or -misc_reserved_115
-116 or -misc_reserved_116
-117 or -misc_reserved_117
-118 or -misc_reserved_118
-119 or -misc_reserved_119
-120 or -opfire_range_prob_factor
-121 or -opfire_ground_prob
-122 or -opfire_air_prob
-123 or -opfire_airstrike_prob
-124 or -opfire_reserved_124
-125 or -opfire_reserved_125
-126 or -max_hex_opfire_attacks
-127 or -opfire_airstrike_fire_effect
-128 or -opfire_airstrike_low_flying_fire_effect
-129 or -opfire_reserved_129
-130 or -dirfire_sam2helolow_prob
-131 or -dirfire_sam2helohigh_prob
-132 or -opfire_sam2helolow_prob
-133 or -opfire_sam2helohigh_prob
-134 or -opfire_sam2helo_prob
-135 or -sam_reserved_135
-136 or -sam_reserved_136
-137 or -sam_reserved_137
-138 or -sam_reserved_138
-139 or -sam_reserved_139
-140 or -helo_turns_until_refuel
-141 or -helo_refuel_forced_landing_prob
-142 or -helo_reserved_142
-143 or -helo_reserved_143
-144 or -helo_reserved_144
-145 or -helo_reserved_145
-146 or -helo_reserved_146
-147 or -helo_reserved_147
-148 or -helo_reserved_148
-149 or -helo_reserved_149
-150 or -direct_fire_low_on_ammo_effect
-151 or -direct_fire_fatigued_effect
-152 or -direct_fire_disrupted_effect
-153 or -direct_fire_doubletime_effect
-154 or -direct_fire_reduced_aa_effect
-155 or -direct_fire_dig_in_effect
-156 or -direct_fire_flank_effect
-157 or -direct_fire_slow_fliers_aa_effect
-158 or -direct_fire_recon_effect
-159 or -direct_fire_fast_effect
-160 or -assault_attack_low_on_ammo_effect
-161 or -assault_attack_fatigued_effect
-162 or -assault_attack_aggressiveness_effect
-163 or -assault_attack_mounted_effect
-164 or -assault_attack_halftrack_effect
-165 or -assault_attack_vehicle_hard_terrain_effect
-166 or -assault_attack_vehicle_soft_terrain_effect
-167 or -assault_attack_nofire_nomove_effect
-168 or -assault_attack_night_effect
-169 or -assault_attack_flank_effect
-170 or -assault_defense_low_on_ammo_effect
-171 or -assault_defense_fatigued_effect
-172 or -assault_defense_disrupted_effect
-173 or -assault_defense_dig_in_effect
-174 or -assault_defense_hardtarget_soft_terrain_effect
-175 or -assault_defense_vehicle_urban_effect
-176 or -assault_defense_nofire_nomove_effect
-177 or -assault_defense_disrupted_morale_adjustment
-178 or -assault_defense_flank_morale_adjustment
-179 or -assault_defense_reserved_179
-180 or -spotter_prob
-181 or -air_spotter_prob
-182 or -recon_reveal_prob
-183 or -air_recon_reveal_prob
-184 or -recon_reveal_cost
-185 or -visibility_reserved_185
-186 or -visibility_reserved_186
-187 or -visibility_reserved_187
-188 or -visibility_reserved_188
-189 or -visibility_reserved_189
-190 or -airstrike_prob
-191 or -airstrike_denied_prob
-192 or -aircraft_loiter_refuel_effect
-193 or -airstrike_strength
-194 or -airstrike_spotted_scatter_prob
-195 or -airstrike_unspotted_scatter_prob
-196 or -airstrike_spotted_scatters
-197 or -airstrike_unspotted_scatters
-198 or -airstrike_attack_hard
-199 or -airstrike_attack_soft
-200 or -airstrike_ground_attack_accuracy_effect
-201 or -airstrike_low_flying_accuracy_effect
-202 or -airstrike_guns_accuracy_effect
-203 or -airstrike_dive_bomber_accuracy_effect
-204 or -airstrike_smart_munitions_accuracy_effect
-205 or -airstrike_fire_forget_accuracy_effect
-206 or -airstrike_smart_munitions_hardtarget_effect
-207 or -air_reserved_207
-208 or -air_reserved_208
-209 or -air_reserved_209
-210 or -airstrike_bombs_disrupt_effect
-211 or -airstrike_rockets_disrupt_effect
-212 or -airstrike_ground_attack_disrupt_effect
-213 or -airstrike_napalm_disrupt_effect
-214 or -air_reserved_214
-215 or -air_reserved_215
-216 or -air_reserved_216
-217 or -air_reserved_217
-218 or -air_reserved_218
-219 or -air_reserved_219



Whoa! That's a lot of parameters. (In future, we will probably add still more.)

Let's begin simply by showing the hard-coded, initialization defaults for the first two AAI parameters, in the general AAI file, init.ai. We do this for the Middle East game:



rober@Rob10rto ~/cslint
$ ./csaiprpt.pl -g me -defaults -0 -1 -f init.ai

init.ai

d 12 6



Instead of specifying by parameter number (with #s starting from 0!), let's repeat the previous command, but with the parameter names:



rober@Rob10rto ~/cslint
$ ./csaiprpt.pl -g me -defaults -hot_max -hot_trigger -f init.ai

init.ai

d 12 6



Let's now see, for s[ide] lines, the parameter values for fire_starshell_prob & starshell_scatter_prob:



rober@Rob10rto ~/cslint
$ ./csaiprpt.pl -g me -defaults -side -fire_starshell_prob -starshell_scatter_prob -f init.ai

init.ai

d 80 40
s 0 A -1 -1
s 1 B -1 -1



The default fire_starshell_prob is 80, while the default starshell_scatter_prob is 40. There are no side overrides; in each case, for either side, the -1 indicate defer to the defaults.

Let's add n[ation] lines to the display:



rober@Rob10rto ~/cslint
$ ./csaiprpt.pl -g me -defaults -side -nation -fire_starshell_prob -starshell_scatter_prob -f init.ai

init.ai

d 80 40
s 0 A -1 -1
s 1 B -1 -1
n 8 XFranceNation 72 28
n 9 XUnitedKingdomNation 72 28
n 14 XGenericProWestNation 52 38
n 22 XIsraelNation 76 26
n 23 XEgyptNation 60 34
n 24 XIraqNation 56 36
n 25 XJordanNation 64 32
n 26 XSyriaNation 56 36
n 27 XLebanonNation 60 34
n 28 XGenericProEastNation 52 38
n 29 XLibyaNation 56 36
n 30 XAlgeriaNation 56 36



For each nation, the indicated probs, since they are not -1, they all override the default prob values.

You can see where, compared to the Arab nations, the Israelis, French & British tend to have higher fire_starshell_prob (greater chance of success), while the tendency of their starshells (flares) to scatter is lower.

Switching now to Vietnam, let's see the assault_attack_aggressiveness_effect & assault_attack_night_effect:



rober@Rob10rto ~/cslint
$ ./csaiprpt.pl -g vn -defaults -side -nation -assault_attack_aggressiveness_effect -assault_attack_night_effect -f init.ai

init.ai

d 100 100
s 0 A -1 -1
s 1 B -1 -1
n 0 XPeoplesRepublicOfChinaNation 105 90
n 8 XFranceNation 97 92
n 10 XUnitedStatesOfAmericaNation 98 94
n 11 XRepublicOfVietnamNation 74 70
n 12 XSouthKoreaNation 86 86
n 13 XLaosNation 80 82
n 17 XNewZealandNation 98 94
n 19 XAustraliaNation 98 94
n 21 XPeoplesRepublicOfVietnamNation 120 119
n 49 XCambodiaNation 80 82
n 50 XThailandNation 88 90



Compare the XRepublicOfVietnamNation (ARVN) values, 74 70, to the XPeoplesRepublicOfVietnamNation (VC/NVA), 120 119. You can now begin to see why the ARVN have such a tough time fighting the Communists.

Let's take a look at those aggressiveness effects in the scenario .ai file VN_550429_Saigon.ai:



rober@Rob10rto ~/cslint
$ ./csaiprpt.pl -g vn -defaults -side -nation -assault_attack_aggressiveness_effect -assault_attack_night_effect -f VN_550429_Saigon.ai

Scenarios/VN_550429_Saigon.ai

d 100 100
s 0 A -1 -1
s 1 B -1 -1
n 0 XPeoplesRepublicOfChinaNation -1 -1
n 8 XFranceNation -1 -1
n 10 XUnitedStatesOfAmericaNation -1 -1
n 11 XRepublicOfVietnamNation -1 -1
n 12 XSouthKoreaNation -1 -1
n 13 XLaosNation -1 -1
n 17 XNewZealandNation -1 -1
n 19 XAustraliaNation -1 -1
n 21 XPeoplesRepublicOfVietnamNation 74 70
n 49 XCambodiaNation -1 -1
n 50 XThailandNation -1 -1



You can see where the XRepublicOfVietnamNation (ARVN) values are -1. Which means that we defer to the init.ai values, 74 70. (See the earlier init.ai example.)

For n[ation] 21, the general init.ai values are 120 119. But in the case of the VN_550429_Saigon scenario, we override those general values with the scenario specific values 74 70, same as the n[ation] 11 values. This is because in this scenario, the ARVN are not fighting VC (or NVA), rather the BX Army, which is generally equivalent in character to the ARVN. (It's complicated. See the Adaptive AI reference in the Manual folder for more details.)

Note that if you omit the '-f <file>' in the csaiprpt.pl command line, it will show the indicated AAI parameter values for the init.ai file and any scenario-specific .ai file. In the Vietnam game, currently there is just the one scenario .ai file. The previous commands omitting the '-f <file>':



rober@Rob10rto ~/cslint
$ ./csaiprpt.pl -g vn -defaults -side -nation -assault_attack_aggressiveness_effect -assault_attack_night_effect

init.ai

d 100 100
s 0 A -1 -1
s 1 B -1 -1
n 0 XPeoplesRepublicOfChinaNation 105 90
n 8 XFranceNation 97 92
n 10 XUnitedStatesOfAmericaNation 98 94
n 11 XRepublicOfVietnamNation 74 70
n 12 XSouthKoreaNation 86 86
n 13 XLaosNation 80 82
n 17 XNewZealandNation 98 94
n 19 XAustraliaNation 98 94
n 21 XPeoplesRepublicOfVietnamNation 120 119
n 49 XCambodiaNation 80 82
n 50 XThailandNation 88 90

Scenarios/VN_550429_Saigon.ai

d 100 100
s 0 A -1 -1
s 1 B -1 -1
n 0 XPeoplesRepublicOfChinaNation -1 -1
n 8 XFranceNation -1 -1
n 10 XUnitedStatesOfAmericaNation -1 -1
n 11 XRepublicOfVietnamNation -1 -1
n 12 XSouthKoreaNation -1 -1
n 13 XLaosNation -1 -1
n 17 XNewZealandNation -1 -1
n 19 XAustraliaNation -1 -1
n 21 XPeoplesRepublicOfVietnamNation 74 70
n 49 XCambodiaNation -1 -1
n 50 XThailandNation -1 -1

Scenarios/_scenario_boilerplate.ai

d 100 100
s 0 A -1 -1
s 1 B -1 -1
n 98 UNUSED -1 -1
n 99 UNUSED -1 -1



In the examples, you are not seeing csaiprpt.pl output to best effect. This is because the Forum software strips out extra spaces, hence this command's careful output formatting. At the Linux command line, this is actually how the previous command and its output would appear:

csaiprpt1.JPG
csaiprpt1.JPG (63.25 KiB) Viewed 2515 times

You will see many other examples of csaiprpt.pl usage in this and other threads (including further explanation of using other WSL Linux tools). But the above should be enough to get you started.

If you have questions, just ask here in the Forum.

Good luck! Happy data mining!
Campaign Series Legion https://cslegion.com/
Campaign Series Lead Coder https://www.matrixgames.com/forums/view ... hp?f=10167
Panzer Campaigns, Panzer Battles Lead Coder https://wargameds.com
User avatar
berto
Posts: 21461
Joined: Wed Mar 13, 2002 1:15 am
Location: metro Chicago, Illinois, USA
Contact:

Re: CSlint How-To

Post by berto »

cslint


cslint.exe is an EXE (executable program) to report syntax errors in the game data files.

cslint.exe comes in two flavors:
  • cslint_elf.exe -- WSL version
  • cslint_pe32.exe -- Cygwin version
You will more than likely be running WSL Linux, hence you will probably use cslint_elf.

Note that in all the examples to follow, we omit the '.exe' in our command line invocations, since for purposes of command execution, the '.exe' is unnecessary.

Start by displaying the program help:


CSlint_cslint_elf1.jpg
CSlint_cslint_elf1.jpg (170.21 KiB) Viewed 2359 times


Whether you use cslint_elf or cslint_pe32, the results should be the same. Hereafter, we will be using cslint_pe32, since we use Cygwin, and our cslint.conf is set up for that.

That help display looks intimidating! Relax! Most of those options are obscure; in normal operation, you the user need not concern yourself with them. We will only demonstrate and explain the most commonly used options here.

Here is a command to syntax check the Vietnam init.ai file:



rober@Rob10rto ~/cslint
$ ./cslint_pe32 -n +w +e -g vn init.ai
[nil]



The options



+|-n show/don't show notices
+|-w show/don't show warnings
+|-e show/don't show errors



are to display, using '+' (plus), or not display (ignore), using '-' (minus)

  • NOTICE -- issues that may or may not be significant, mainly are not; maybe 1 in 100 notices are truly significant; there will be many false positives here!
  • WARNING -- issues that might be significant, but are not showstoppers; maybe 1 in 10 warnings are important
  • ERROR -- showstopper issues, outright errors; except for known false positives, every error will usually be important

In our first syntax check of the init.ai file above, the output was '[nil]', meaning to say there was no output. This is good! No output indicates no issues, a totally clean syntax check.

Let's check the Vietnam game's sounds configuration file, sounds.dat:



rober@Rob10rto ~/cslint
$ ./cslint_pe32 -n +w +e -g vn sounds.dat

ERROR: missing file: /cygdrive/c/Games/Matrix Games/Vietnam/vietnam/sounds.dat



Oh! What's up with that?

The problem is that when listing the file, we need to tell cslint the data file's location. In the case of init.ai above, without any folder, that says to look into the game's top-level folder. The sounds.dat file is tucked away in the game's Data folder, so we need to indicate that:



rober@Rob10rto ~/cslint
$ ./cslint_pe32 -n +w +e -g vn Data/sounds.dat
[nil]



Ah, good. No ERROR: missing file, and otherwise no problems with the file's syntax.

We check the Platoon10.oob file for issues. Note where we prepend 'OOBs/' to the Platoon10.oob file name, since OOBs is where that file resides:



rober@Rob10rto ~/cslint
$ ./cslint_pe32 +n +w +e -g vn OOBs/Platoon10.oob

WARNING: /cygdrive/c/Games/Matrix Games/Vietnam/vietnam/OOBs/Platoon10.oob, at (or near) line 399: suspicious value: 0 (field 5)
WARNING: /cygdrive/c/Games/Matrix Games/Vietnam/vietnam/OOBs/Platoon10.oob, at (or near) line 400: suspicious value: 0 (field 5)
WARNING: /cygdrive/c/Games/Matrix Games/Vietnam/vietnam/OOBs/Platoon10.oob, at (or near) line 401: suspicious value: 0 (field 5)
WARNING: /cygdrive/c/Games/Matrix Games/Vietnam/vietnam/OOBs/Platoon10.oob, at (or near) line 402: suspicious value: 0 (field 5)
WARNING: /cygdrive/c/Games/Matrix Games/Vietnam/vietnam/OOBs/Platoon10.oob, at (or near) line 2058: suspicious value: 0 (field 7)
WARNING: /cygdrive/c/Games/Matrix Games/Vietnam/vietnam/OOBs/Platoon10.oob, at (or near) line 2058: suspicious value: 0 (field 8)
WARNING: /cygdrive/c/Games/Matrix Games/Vietnam/vietnam/OOBs/Platoon10.oob, at (or near) line 2059: suspicious value: 0 (field 7)
WARNING: /cygdrive/c/Games/Matrix Games/Vietnam/vietnam/OOBs/Platoon10.oob, at (or near) line 2059: suspicious value: 0 (field 8)
WARNING: /cygdrive/c/Games/Matrix Games/Vietnam/vietnam/OOBs/Platoon10.oob, at (or near) line 2061: suspicious value: 0 (field 7)
WARNING: /cygdrive/c/Games/Matrix Games/Vietnam/vietnam/OOBs/Platoon10.oob, at (or near) line 2061: suspicious value: 0 (field 8)



Hmm. "suspicious value" -- that looks suspicious. How is that a syntax error? Well, you see, to a limited extent, cslint will also check data values, typically to WARN if a value is outside the usual range, and to report ERROR if a value is far outside the usual range. For example, in init.ai, if a prob value were > 100, that would be an ERROR.

In the above case, after looking in Platoon10.oob, we assess that those 0s are fine, those WARNINGs are in fact false positives, of no real concern.

We check the Platoon49.oob file:



rober@Rob10rto ~/cslint
$ ./cslint_pe32 -n +w +e -g vn OOBs/Platoon49.oob

ERROR: /cygdrive/c/Games/Matrix Games/Vietnam/vietnam/OOBs/Platoon49.oob, at (or near) line 89: line-specific or other contextual syntax error: #L# (0x4c), #Land Rovers , Land Rovers ,
#



We have our first genuine syntax error! Let's look in the file, here showing lines 86-90, with line 88 highlighted



P497033 3 0 1 0 50 50 100 52 2 1 1 3 4 9 0 0 10 77 P497031 1 16 32 2 64 0 0 48 1 75 12 0 0 0 1/4 ton truck , MB/M38 ,
P497034 2 0 1 0 50 50 100 52 2 1 1 3 4 9 0 0 10 77 P497031 1 16 32 2 64 0 0 48 1 75 12 0 0 0 1/4 ton truck , MB/M38 ,
P497035 6 2 1 0 50 50 95 55 2 1 1 4 0 9 0 0 10 81 P497035 2 16 32 0 64 0 0 49 1 12 0 0 0 Land Rovers , Land Rovers , [line 88]
P497036 4 2 1 0 50 50 95 55 2 1 1 4 0 9 0 0 10 81 P497035 2 16 32 0 64 0 0 49 1 85 12 0 0 0 Land Rovers , Land Rovers , [line 89]
P497037 3 2 1 0 50 50 95 55 2 1 1 4 0 9 0 0 10 81 P497035 2 16 32 0 64 0 0 49 1 85 12 0 0 0 Land Rovers , Land Rovers ,



The ERROR is hard to spot; you really need to understand the data formats. But you might notice where the unit start year/month and end year/month, highlighted in blue above, are mistaken in line 88. Where is the end year for unit P497035? It is missing. There is our syntax error! We fix the line, adding the missing year, 85:



P497035 6 2 1 0 50 50 95 55 2 1 1 4 0 9 0 0 10 81 P497035 2 16 32 0 64 0 0 49 1 85 12 0 0 0 Land Rovers , Land Rovers , [line 88]



And retry the command:



rober@Rob10rto ~/cslint
$ ./cslint_pe32 -n +w +e -g vn OOBs/Platoon49.oob
[nil]



No ([nil]) output. Yay! Issue fixed.

"Wait a minute!", you say. cslint reported the ERROR in line 89, when in fact the mistake (missing value) was in line 88. Well, it is an unfortunate flaw in the underlying cslint syntax checking technique where it will sometimes overshoot, report an issue in line X, where actually the issue is in the preceding line, X-1. When using cslint, you will need to bear this imprecision in mind.

Let's suppose we play the scenario VN_650511_Song_Be, but notice something funky about the Visibility; it't not quite right.

cslint shows us the issue:



rober@Rob10rto ~/cslint
$ ./cslint_pe32 -n +w +e -g vn Scenarios/VN_650511_Song_Be.scn

ERROR: /cygdrive/c/Games/Matrix Games/Vietnam/vietnam/Scenarios/VN_650511_Song_Be.scn, at (or near) line 5: line-specific or other contextual syntax error: #[# (0x5b), #[#



We look into the VN_650511_Song_Be.scn file:



[-------------------------------- data header --------------------------------]
32
The Last Stand - Battle of Song Be
0 0 0 1-25[d]
0 0 0 0 1-13[5] 14-20[6} 21-25[5]
12 0 0 0 90 100 90 95
0
300 500 800 1100 10 0 8
100 100 0 -1
...



Do you spot the mistake? In the Visibility specification, instead of a ']', a '}' was used. (The scen editor should report this error at the time the scenario designer misspecifies it. But if it does not, or if the scenario designer ignores it, the error remains, causing later scenario malfunction.)

In this case, cslint got the line # right, line 5, but it reported the wrong mistake, an allegedly mistaken '['. Here too, cslint might only make its best guess what the problem might be. cslint often pinpoints the line and the character with exact precision, but sometimes not.



Here are some sample issues that cslint has reported over the months and years:



ERROR: /cygdrive/c/Games/Matrix Games/Vietnam/vietnam/OOBs/Platoon08.oob, at (or near) line 4: line-specific or other contextual syntax error: #X# (0x58), #X21 4 4 5 40 99 99 58 32 16 2 3 1 29 0 0 1 6 82 P080002 3 33 0 1 72 2097167 48 1 70 12 5 2 2 M5A1 Light Tanks , M5A1 , Stuart



Note the mistaken 'X'.



ERROR: /cygdrive/c/Games/Matrix Games/Vietnam/vietnam/OOBs/Platoon19.oob, at (or near) line 223: line-specific or other contextual syntax error: #a# (0x61), #a 0 3 35 50 50 10 5 0 2 1 0 0 11 0 0 379 125 P193006 2 2 131 0 0 4194304 65 1 85 12 0 0 0 Brigade Battlegroup HQ 65 (foot) , Brigade BG 65 ,



Note the mistaken 'a'.



ERROR: /cygdrive/c/Games/Matrix Games/Vietnam/vietnam/data/weapon.pdt, at (or near) line 5669: line-specific or other contextual syntax error: #1# (0x31), #18#



In the preceding case, in the weapon.pdt file, there was a duplicate data line (highlighted):



...
P109745 60 50 40 30 20 10
18 17 16 15 14 13 12 11 10 9 8 8 7 7 6 6 6 5 5 5
18 17 16 15 14 13 12 11 10 9 8 8 7 7 6 6 6 5 5 5
...



ERROR: /cygdrive/c/Games/Matrix Games/Vietnam/vietnam/scenarios/LA_690612_Kingpin_A.scn, at (or near) line 2: illegal value: 27
ERROR: /cygdrive/c/Games/Matrix Games/Vietnam/vietnam/scenarios/LA_690612_Kingpin_A.scn, at (or near) line 23: line-specific or other contextual syntax error: #^M# (0xd), #^M



In the preceding case, LA_690612_Kingpin_A.scn was an older, version 27 scenario that required updating to later, version 28 standards. The second ERROR was a consequence of the LA_690612_Kingpin_A.scn file's obsolescence.

Using cslint to syntax (and value) check the data files can be tricky, sometimes hard to interpret. It is more a developer QA tool than it is intended for the end user, or the modder. cslint is not intended for novice use!

We have a wrapper utility, not released with the game but withheld for our (the developers') use only, that syntax checks all (or almost all) of the game data files. Here is output from checking the East Front data files:



rober@Rob10rto ~/cslint
$ egrep "ERROR" cslintallchk.ef.20210228a.out
ERROR: missing file: /cygdrive/c/Games/Matrix Games/East Front/east_front/data/timelines.dat
ERROR: missing file: /cygdrive/c/Games/Matrix Games/East Front/east_front/data/Attacker.dat
ERROR: /cygdrive/c/Games/Matrix Games/East Front/east_front/scenarios/FI_391208_Tolvajarvi_Mockup.scn, at (or near) line 24: line-specific or other contextual syntax error: #[# (0x5b), #[-------------------------------- data footer --------------------------------]
ERROR: /cygdrive/c/Games/Matrix Games/East Front/east_front/init.ai, at (or near) line 13: illegal value: 65 (field 193)
ERROR: /cygdrive/c/Games/Matrix Games/East Front/east_front/init.ai, at (or near) line 14: illegal value: 65 (field 193)
ERROR: /cygdrive/c/Games/Matrix Games/East Front/east_front/init.ai, at (or near) line 18: illegal value: 98 (field 170)
ERROR: /cygdrive/c/Games/Matrix Games/East Front/east_front/init.ai, at (or near) line 18: illegal value: 98 (field 179)
ERROR: /cygdrive/c/Games/Matrix Games/East Front/east_front/init.ai, at (or near) line 18: illegal value: 4 (field 180)
ERROR: /cygdrive/c/Games/Matrix Games/East Front/east_front/init.ai, at (or near) line 18: illegal value: 1 (field 181)
ERROR: /cygdrive/c/Games/Matrix Games/East Front/east_front/init.ai, at (or near) line 19: illegal value: 3 (field 180)
ERROR: /cygdrive/c/Games/Matrix Games/East Front/east_front/init.ai, at (or near) line 19: illegal value: 1 (field 181)
ERROR: /cygdrive/c/Games/Matrix Games/East Front/east_front/init.ai, at (or near) line 20: illegal value: 3 (field 180)
ERROR: /cygdrive/c/Games/Matrix Games/East Front/east_front/init.ai, at (or near) line 20: illegal value: 1 (field 181)
ERROR: /cygdrive/c/Games/Matrix Games/East Front/east_front/init.ai, at (or near) line 21: illegal value: 3 (field 180)
ERROR: /cygdrive/c/Games/Matrix Games/East Front/east_front/init.ai, at (or near) line 21: illegal value: 1 (field 181)
ERROR: /cygdrive/c/Games/Matrix Games/East Front/east_front/scenarios/_TEMPLATE.ai, at (or near) line 25: line-specific or other con# (0xd), #ntax error: #
ERROR: missing file: /cygdrive/c/Games/Matrix Games/East Front/east_front/OOBs/Leader02.oob
ERROR: missing file: /cygdrive/c/Games/Matrix Games/East Front/east_front/OOBs/Leader31.oob
ERROR: missing file: /cygdrive/c/Games/Matrix Games/East Front/east_front/OOBs/Leader41.oob
ERROR: /cygdrive/c/Games/Matrix Games/East Front/east_front/OOBs/Campaign20.oob, at (or near) line 7: line-specific or other contextual syntax error: #(# (0x28), #(33)#
ERROR: /cygdrive/c/Games/Matrix Games/East Front/east_front/OOBs/Campaign31.oob, at (or near) line 69: line-specific or other contextual syntax error: #(# (0x28), #(15)#
ERROR: missing file: /cygdrive/c/Games/Matrix Games/East Front/east_front/OOBs/Campaign41.oob



Several false positives there, but for the most part, those are significant issues that needed to be addressed.

We include cslint in the standard installation because there are instances where only cslint can detect and pinpoint a problem otherwise so obscure that no amount of time and effort and staring at the data file(s) will reveal its secrets.

When you need to find that needle (bug) in the haystack (data file), cslint is your metal detector!

You might see other examples of cslint usage in this and other threads (including further explanation of using other WSL Linux tools). But the above should be enough to get you started.

If you have questions, just ask here in the Forum.

Good luck! Happy bug hunting!
Campaign Series Legion https://cslegion.com/
Campaign Series Lead Coder https://www.matrixgames.com/forums/view ... hp?f=10167
Panzer Campaigns, Panzer Battles Lead Coder https://wargameds.com
User avatar
berto
Posts: 21461
Joined: Wed Mar 13, 2002 1:15 am
Location: metro Chicago, Illinois, USA
Contact:

Re: CSlint How-To

Post by berto »

csscnchk.pl


csscnchk.pl is a Perl script (program) to check the scenario (.scn) files for various errors.

(Note: In the course of preparing this, we implemented some fixes not available in the current public CSlint release. The updated csscnchk.pl will be included in CSVN v1.20 and later. Until then, if you try the exercises following, your results might vary.)

Start by displaying the program help:



rober@Rob10rto ~/cslint
$ ./csscnchk.pl -h

Usage: csscnchk.pl [-h|-help] [{+|-}G|-debug] [{+|-}n] [{+|-}w] [{+|-}e] -g[ame] {me|vn|cw|ef|wf|pf} [-f <scenario file>]



Try this command, which will check all Vietnam scenario files:



rober@Rob10rto ~/cslint
$ ./csscnchk.pl -g vn
ERROR: BC_670601_Bootcamp_03.scn: at hex 34,22, supply unit at AirfieldHex without LandingZone
ERROR: BC_670601_Bootcamp_03.scn: at hex 38,24, supply unit at AirfieldHex without LandingZone
ERROR: XP_671231_PBEM_Set_A01.scn: at hex 67,12, LZ (0x00440000) awareness A occupying side B mismatch



The output shows:
  • the issue level, ERROR, WARNING or NOTICE
  • the scenario (.scn) file name
  • the line # where the issue occurred (if applicable)
  • the issue detail
By default, without any command-line options, csscnchk.pl defaults to showing only ERRORs. Why? It is because that is the default in our cslint.conf file:



$ cat cslint.conf
# cslint.conf -- default CSlint configurations

# for the following configs, may be any of:
#
# yes|YES|true|TRUE|on|ON
# no|NO|false|FALSE|off|OFF
#
# omitting any config (perhaps by commenting out) defaults its setting to 'no'

show_notice no
show_warning no
show_error yes

show_files yes
show_linenos yes
test no
debug no

# for the following configs, set the appropriate directory (folder) path
# cslintroot & gameroot are required

cslintroot "/home/rober/cslint"

gameroot "/cygdrive/c/Games/Matrix Games"

# for non-default game installations, change the following configs as needed
# these are optional, but advised

vndir "Vietnam/vietnam"
medir "Middle East/middle_east"
cwdir "Cold War/cold_war"

efdir "East Front/east_front"
wfdir "West Front/west_front"
pfdir "Pacific Front/pacific_front"



If in addition to ERRORs we also want to see WARNINGs, we would do that via:



rober@Rob10rto ~/cslint
$ ./csscnchk.pl -n +w +e -g vn
WARNING: BC_670601_Bootcamp_01.map mod time later than BC_670601_Bootcamp_01.scn mod time
WARNING: BC_670601_Bootcamp_01.scn: at hex 34,22, AirfieldHex without LandingZone
WARNING: BC_670601_Bootcamp_01.scn: at hex 35,23, AirfieldHex without LandingZone
WARNING: BC_670601_Bootcamp_01.scn: at hex 36,23, AirfieldHex without LandingZone
WARNING: BC_670601_Bootcamp_01.scn: at hex 37,24, AirfieldHex without LandingZone
[... output omitted for brevity ...]
WARNING: BC_670601_Bootcamp_02.scn: at hex 50,20, AirfieldHex without LandingZone
WARNING: BC_670601_Bootcamp_02.scn: at hex 51,21, AirfieldHex without LandingZone
ERROR: BC_670601_Bootcamp_03.scn: at hex 34,22, supply unit at AirfieldHex without LandingZone
ERROR: BC_670601_Bootcamp_03.scn: at hex 38,24, supply unit at AirfieldHex without LandingZone
WARNING: BC_670601_Bootcamp_03.scn: at hex 48,19, AirfieldHex without LandingZone
WARNING: BC_670601_Bootcamp_03.scn: at hex 49,20, AirfieldHex without LandingZone
[... output omitted for brevity ...]
WARNING: IC_540314_DBP3_Gabrielle_H.scn: at hex 42,22, block (0x00400008) awareness A adjacent hex 43,22 occupying side B mismatch
WARNING: IC_540322_DBP4_Breakthru_Isabelle.scn: at hex 36,42, IEDs (0x00480000) awareness A adjacent hex 36,43 occupying side B mismatch
WARNING: IC_540322_DBP4_Breakthru_Isabelle.scn: at hex 36,42, IEDs (0x00480000) awareness A adjacent hex 35,43 occupying side B mismatch
[... output omitted for brevity ...]
WARNING: VN_640820_Ben_Tre.org mod time later than VN_640820_Ben_Tre.scn mod time
WARNING: VN_641230_Binh_Gia.org mod time later than VN_641230_Binh_Gia.scn mod time
WARNING: VN_641231_Binh_Gia.org mod time later than VN_641231_Binh_Gia.scn mod time
[... output omitted for brevity ...]
WARNING: XP_671231_PBEM_Set_A02.scn:21: for nation 0 (XPeoplesRepublicOfChinaNation), side 1 differs from default side 0
WARNING: XP_671231_PBEM_Set_A03.scn:21: for nation 0 (XPeoplesRepublicOfChinaNation), side 1 differs from default side 0
[... output omitted for brevity ...]
WARNING: XT_671231_Tournament_Set_A06.scn: at hex 94,44, LZ (0x00840000) awareness B adjacent hex 95,44 occupying side A mismatch
WARNING: XT_671231_Tournament_Set_A06.scn: at hex 98,41, LZ (0x00840000) awareness B adjacent hex 98,42 occupying side A mismatch
WARNING: XT_671231_Tournament_Set_A06.scn: at hex 118,30, LZ (0x00440000) awareness A adjacent hex 118,29 occupying side B mismatch
WARNING: XT_671231_Tournament_Set_A06.scn: at hex 119,30, LZ (0x00440000) awareness A adjacent hex 118,29 occupying side B mismatch
WARNING: XT_671231_Tournament_Set_A07.scn:21: for nation 0 (XPeoplesRepublicOfChinaNation), side 1 differs from default side 0



The options



+|-n show/don't show notices
+|-w show/don't show warnings
+|-e show/don't show errors



are to display, using '+' (plus), or not display (ignore), using '-' (minus)

  • NOTICE -- issues that may or may not be significant, mainly are not; maybe 1 in 100 notices are truly significant; there will be many false positives here!
  • WARNING -- issues that might be significant, but are not showstoppers; maybe 1 in 10 warnings are important
  • ERROR -- showstopper issues, outright errors; except for known false positives, every error will usually be important

Beware of false positives! And exceptions. In some of the examples shown here, in fact the "ERRORs" are deliberate. (Please remember this if you run cssnchk.pl against the standard install .scn files. With every release, you can be certain that we have done that, and noted and if necessary fixed any true positive ERRORs etc. CSlint is on the case!)

By default, csscnchk.pl checks every game .scn file. That could generate many output lines. In our test run here, there were



rober@Rob10rto ~/cslint
$ ./csscnchk.pl -n +w +e -g vn | wc -l
282



282 such lines, enough to engulf the terminal window. In order to make it more manageable, you could output to the 'less' utility:



rober@Rob10rto ~/cslint
$ ./csscnchk.pl -n +w +e -g vn | less



More typically, you would want to check one file at a time, for instance, your current modding project. For example



rober@Rob10rto ~/cslint
$ ./csscnchk.pl +n +w +e -g vn -f XT_671231_Tournament_Set_A03.scn
NOTICE: for XT_671231_Tournament_Set_A03.scn, missing XT_671231_Tournament_Set_A03.ai
WARNING: XT_671231_Tournament_Set_A03.scn:21: for nation 0 (XPeoplesRepublicOfChinaNation), side 1 differs from default side 0
NOTICE: XT_671231_Tournament_Set_A03.scn: at hex 37,88, LZ (0x00c40000) awareness AB
NOTICE: XT_671231_Tournament_Set_A03.scn: at hex 38,88, LZ (0x00c40000) awareness AB
NOTICE: XT_671231_Tournament_Set_A03.scn: at hex 39,85, LZ (0x00c40000) awareness AB
NOTICE: XT_671231_Tournament_Set_A03.scn: at hex 39,86, LZ (0x00c40000) awareness AB
NOTICE: XT_671231_Tournament_Set_A03.scn: at hex 39,87, LZ (0x00c40000) awareness AB
NOTICE: XT_671231_Tournament_Set_A03.scn: at hex 39,88, LZ (0x00c40000) awareness AB
NOTICE: XT_671231_Tournament_Set_A03.scn: at hex 39,89, LZ (0x00c40000) awareness AB
NOTICE: XT_671231_Tournament_Set_A03.scn: at hex 40,98, LZ (0x00c40000) awareness AB
WARNING: XT_671231_Tournament_Set_A03.scn: at hex 120,56, LZ (0x00440000) awareness A adjacent hex 121,57 occupying side B mismatch
WARNING: XT_671231_Tournament_Set_A03.scn: at hex 121,56, LZ (0x00440000) awareness A adjacent hex 121,57 occupying side B mismatch



checks and reports issues in just the one file, XT_671231_Tournament_Set_A03.scn. Note that by means of '+n', we have toggled ON display of NOTICEs.



csscnchk.pl checks all mannner of scenario file issues. Here are several past examples:



...
ERROR: VN_660108_Ho_Bo_Woods.scn:240: id 216808 not found in VN_660108_Ho_Bo_Woods.org
ERROR: VN_660108_Ho_Bo_Woods.scn:240: trackid 707 not found in VN_660108_Ho_Bo_Woods.org
ERROR: VN_660108_Ho_Bo_Woods.scn:369: id 216808 not found in VN_660108_Ho_Bo_Woods.org
ERROR: VN_660108_Ho_Bo_Woods.scn:369: trackid 708 not found in VN_660108_Ho_Bo_Woods.org
...



ERROR: for VN_680130_Pleiku.scn, missing VN_680130_Pleiku.map



WARNING: LA_670315_Interdiction_H.scn:48: for ATG helo, mistaken rounds 0 and resupply_rounds 0: P106571 781 4 4 1 0 0 0 100 6 0 0 0 3 3 3 3 0 3 -1 -1 9 0 -1 -1 -1 -1 -1 -1 0
WARNING: LA_710915_PaxsongRS_H.scn:26: for ATG helo, mistaken rounds 0 and resupply_rounds 0: 0 0 17 P106574 2756 2 2 1 0 0 0 100 6 0 134217728 0 3 3 3 3 0 3 -1 -1 9 0 -1 -1 -1 -1 -1 -1 0
WARNING: LA_720113_Skyline_H.scn:219: for ATG helo, mistaken rounds 0 and resupply_rounds 0: 0 16 26 P106571 8701 32 32 1 0 0 0 100 6 0 134217728 0 3 3 3 3 0 0 -1 -1 9 0 -1 -1 -1 -1 -1 -1 0
WARNING: LA_720113_Skyline_H.scn:329: for ATG helo, mistaken rounds 0 and resupply_rounds 0: P106572 9528 2 2 1 0 0 0 100 6 0 134217728 0 3 3 3 3 0 3 -1 -1 9 0 -1 -1 -1 -1 -1 -1 0
WARNING: LA_721005_Surprise-Saravan_H.scn:82: for ATG helo, mistaken rounds 0 and resupply_rounds 0: P106572 1651 2 2 1 0 0 0 100 6 0 0 0 3 3 3 3 0 2 -1 -1 9 0 -1 -1 -1 -1 -1 -1 0
WARNING: VN_660309_A_Shau.scn:123: for ATG helo, mistaken rounds 0 and resupply_rounds 0: P106571 58 8 8 1 0 0 0 100 5 0 0 0 3 3 3 3 0 2 -1 -1 9 0 -1 -1 -1 -1 -1 -1 0



ERROR: VN_651019_Plei_Me.scn: all active nations share the same side



WARNING: LA_680215_PHATHI_H.scn:20: for nation 13 (XLaosNation), side -1 differs from default side 0



ERROR: Bir_Gifgafa_1967.scn:157: illegal trackid 0
ERROR: Duel_For_the_Golan_1985-Rafid.scn:5971: illegal trackid 0
ERROR: El_Firdan_1_1973.scn:293: illegal trackid 0
ERROR: RadfanLCG_4.scl:122: illegal trackid 0
ERROR: RadfanLCG_9.scl:288: illegal trackid 0
ERROR: Rafah_1956.scn:704: illegal trackid 0
ERROR: Tournament_Set_B02.scn:691: illegal trackid 0
ERROR: Umm_Qatef_1967.scn:509: illegal trackid 0



The above is not an exhaustive accounting of all the issues that csscnchk.pl might report. So many things might go wrong. You never know when or how. Thus it is a good habit to use csscnchk.pl often.

You might see other examples of csscnchk.pl usage in this and other threads (including further explanation of using awk, sort, uniq, and other Cygwin tools). But the above should be enough to get you started.

If you have questions, just ask here in the Forum.

Good luck! Happy QA (Quality Assurance) checking!
Campaign Series Legion https://cslegion.com/
Campaign Series Lead Coder https://www.matrixgames.com/forums/view ... hp?f=10167
Panzer Campaigns, Panzer Battles Lead Coder https://wargameds.com
User avatar
berto
Posts: 21461
Joined: Wed Mar 13, 2002 1:15 am
Location: metro Chicago, Illinois, USA
Contact:

Re: CSlint How-To

Post by berto »

csorgchk.pl


csorgchk.pl is a Perl script (program) to check the unit organization (.org) files for various errors.

Start by displaying the program help, specifying the Vietnam game:



rober@Rob10rto ~/cslint
$ ./csorgchk.pl -h -g vn

Usage: csorgchk.pl [-h|-help] [{+|-}G|-debug] [{+|-}n] [{+|-}w] [{+|-}e] -g[ame] {me|vn|cw|ef|wf|pf} [-f <organization file>]



Try this command, which will check all Vietnam ORG files, showing only WARNINGs and ERRORs:



rober@Rob10rto ~/cslint
$ ./csorgchk.pl -n +w +e -g vn
[nil]



No output! ('[nil]' means to say there is no output. In actuality, you would not see that displayed.) This is good! There are no WARNINGs or ERRORs in the latest Vietnam .org files.

The options



+|-n show/don't show notices
+|-w show/don't show warnings
+|-e show/don't show errors



are to display, using '+' (plus), or not display (ignore), using '-' (minus)

  • NOTICE -- issues that may or may not be significant, mainly are not; maybe 1 in 100 notices are truly significant; there will be many false positives here!
  • WARNING -- issues that might be significant, but are not showstoppers; maybe 1 in 10 warnings are important
  • ERROR -- showstopper issues, outright errors; except for known false positives, every error will usually be important

(See also the discussion of default cslint.conf settings in the preceding csscnchk.pl post.)

Let's repeat the previous command, but this time showing NOTICEs:



rober@Rob10rto ~/cslint
$ ./csorgchk.pl +n +w +e -g vn
NOTICE: IC_521201_Na_San.org:508: unknown company C801207 CMLE
NOTICE: IC_531120_DBP1_Castor_H.org:121: unknown company C801701 Groupe de bombardement 1/25 "Tunisie"
NOTICE: IC_531120_DBP1_Castor_H.org:123: unknown company C801701 Groupe de transport 1/64 "Bearn"
NOTICE: IC_540313_DBP2_Beatrice_H.org:7: unknown brigade G824025 Sous-secteur Nord
NOTICE: IC_540313_DBP2_Beatrice_H.org:160: unknown brigade G824025 Sous-secteur Centre
[... output omitted for brevity ...]
NOTICE: VN_670424_Khe_Sanh.org:4: unknown brigade G1032001 Khe Sanh Combat Base - and area
NOTICE: VN_670425_Khe_Sanh.org:4: unknown brigade G1032001 Khe Sanh Combat Base - and area
NOTICE: VN_670428_Khe_Sanh.org:4: unknown brigade G1032001 Khe Sanh Combat Base - and area
NOTICE: VN_670503_Khe_Sanh.org:4: unknown brigade G1032001 Khe Sanh Combat Base - and area



Those NOTICEs may or may not be significant. See above about possible false positives.


When checking all .org files, especially when showing NOTICEs via '+n', you might get many lines of output, enough to engulf your terminal window. In that case, you could output to the 'less' utility:



rober@Rob10rto ~/cslint
$ ./csorgchk.pl +n +w +e -g vn | less



More typically, you would want to check one file at a time, for instance, your current modding project. For example



rober@Rob10rto ~/cslint
$ ./csorgchk.pl +n +w +e -g vn -f IC_540402_DBP7_Huguette_Phase_1.org
NOTICE: IC_540402_DBP7_Huguette_Phase_1.org:9: unknown brigade G824025 Sous-secteur l'Ouest
NOTICE: IC_540402_DBP7_Huguette_Phase_1.org:200: unknown brigade G824025 Sous-secteur l'est GM9
NOTICE: IC_540402_DBP7_Huguette_Phase_1.org:306: unknown brigade G824025 Sous-secteur Sud
NOTICE: IC_540402_DBP7_Huguette_Phase_1.org:385: unknown brigade G824025 Groupement Aeroporte 2
NOTICE: IC_540402_DBP7_Huguette_Phase_1.org:661: unknown brigade G824025 Artillerie
NOTICE: IC_540402_DBP7_Huguette_Phase_1.org:684: unknown company C801207 1er Batterie
NOTICE: IC_540402_DBP7_Huguette_Phase_1.org:688: unknown company C801207 2e Batterie
NOTICE: IC_540402_DBP7_Huguette_Phase_1.org:692: unknown company C801207 3e Batterie
NOTICE: IC_540402_DBP7_Huguette_Phase_1.org:700: unknown company C801207 1er Batterie
NOTICE: IC_540402_DBP7_Huguette_Phase_1.org:704: unknown company C801207 2e Batterie



csorgchk.pl checks all mannner of organization file issues. Here are several past examples:



ERROR: VN_651023_Plei_Ngol_Ho.org:394: aircraft P105073 393 missing ordnance ending '}'



WARNING: LA_640719_triangle_H.org:329: unknown platoon P214017 Cdr 1er BP
WARNING: VN_700708_FSB_Ripcord.org:169: unknown platoon P212005 Tham Bao



ERROR: VN_640412_Kien_Long_PM.org:486: bad line: C1102280 513 43rd Weapons Company 62 [missing morale value]



ERROR: VN_631124_Hiep_Hoa.org:2: next available trackid 50 not greater than max trackid 99
ERROR: VN_650220_Mang_Yang.org:2: next available trackid 386 not greater than max trackid 500
ERROR: VN_650511_Song_Be.org:2: next available trackid 411 not greater than max trackid 999



ERROR: EF - Markku Soinio Winter War Scenarios/East Front/MS-Division44.org:4: illegal trackid 0
ERROR: EF - Markku Soinio Winter War Scenarios/East Front/MS-Haukila.org:4: illegal trackid 0
ERROR: EF - Markku Soinio Winter War Scenarios/East Front/MS-Haukiperä.org:4: illegal trackid 0
ERROR: EF - Markku Soinio Winter War Scenarios/East Front/MS-Juntusranta.org:4: illegal trackid 0
ERROR: EF - Markku Soinio Winter War Scenarios/East Front/MS-Kovajärvi.org:4: illegal trackid 0
ERROR: EF - Markku Soinio Winter War Scenarios/East Front/MS-Linna.org:4: illegal trackid 0
ERROR: EF - Markku Soinio Winter War Scenarios/East Front/MS-Siilasvuo.org:4: illegal trackid 0



ERROR: VN_660404_HeloTest_Mang_Yang.org:4: illegal trackid 0



The above is not an exhaustive accounting of all the issues that csorgchk.pl might report. There are still others.

You might see other examples of csorgchk.pl usage in this and other threads. But the above should be enough to get you started.

If you have questions, just ask here in the Forum.

Good luck! Happy QA (Quality Assurance) checking!
Campaign Series Legion https://cslegion.com/
Campaign Series Lead Coder https://www.matrixgames.com/forums/view ... hp?f=10167
Panzer Campaigns, Panzer Battles Lead Coder https://wargameds.com
User avatar
berto
Posts: 21461
Joined: Wed Mar 13, 2002 1:15 am
Location: metro Chicago, Illinois, USA
Contact:

Re: CSlint How-To

Post by berto »

csmapchk.pl


csmapchk.pl is a Perl script (program) to check the map (.map) files for various issues.

Although we include csmapchk.pl in the standard game installation, you the player/modder cannot make effective use of it, because internally (in the csmapchk.pl code) it calls on another program encrypt.exe -- a program not included in the game install, for reasons of security. Still, I document csmapchk.pl here, because it discovers and reports on all sorts of interesting issues. You will also maybe appreciate the care we devote to QAing (Quality Assurancing) the games before release. (And even afterward, because QA never ends!)

We start by displaying the program help, specifying the Vietnam game:



rober@Rob10rto ~/cslint
$ ./csmapchk.pl -g vn -h

Usage: csmapchk.pl [-h|-help] [{+|-}G|-debug] [-M|-nomaster] [+M|-onlymaster] [-E|-noelevation] [+E|-onlyelevation] [-p[rune]] [{+|-}n] [{+|-}w] [{+|-}e] -g[ame] {me|vn|cw|ef|wf|pf} [-f <map file>]



As with every other CSlint QA check utility, the basic options



+|-n show/don't show notices
+|-w show/don't show warnings
+|-e show/don't show errors



are to display, using '+' (plus), or not display (ignore), using '-' (minus)

  • NOTICE -- issues that may or may not be significant, mainly are not; maybe 1 in 100 notices are truly significant; there will be many false positives here!
  • WARNING -- issues that might be significant, but are not showstoppers; maybe 1 in 10 warnings are important
  • ERROR -- showstopper issues, outright errors; except for known false positives, every error will usually be important

When csmapchk.pl was first developed, it reported -- believe it or not -- many thousands of map issues across the hundreds of maps in CSVN and CSME (also CSEF and CSCW). It was overwhelming. To make the review/fixing more manageable, we implemented several options

  • [-M|-nomaster] [+M|-onlymaster] -- to check only the master files (in the Scenarios/master_maps folder), else just the derived subset maps (in the main Scenarios folder); otherwise, omitting either option, check every map
  • [-E|-noelevation] [+E|-onlyelevation] -- to check only elevation issues, or only everything else; otherwise, omitting either option, check everything
  • [-p[rune]] -- to eliminate duplicate issue report instances

We usually employ -p[rune], while the others are selected on a case by case basis.

Here is a csmapchk of the latest CSVN map non-master map files:


rober@Rob10rto ~/cslint
$ ./csmapchk.pl -nomaster -p -n +w +e -g vn

ERROR: VN_660601_Week_In_Binh_Long.map:12795: missing bridge/ford over minor river at 57,224
ERROR: VN_660601_Week_In_Binh_Long.map:12795: missing bridge/ford over minor river at 57,225
ERROR: VN_660601_Week_In_Binh_Long.map:12795: missing bridge/ford over minor river at 58,252
ERROR: VN_660601_Week_In_Binh_Long.map:12795: missing bridge/ford over minor river at 59,253
[... output omitted for brevity ...]
ERROR: VN_660601_Week_In_Binh_Long.map:12795: missing bridge/ford over minor river at 92,253
ERROR: VN_660601_Week_In_Binh_Long.map:12795: missing bridge/ford over minor river at 93,107
ERROR: VN_660601_Week_In_Binh_Long.map:12795: missing bridge/ford over minor river at 100,112
ERROR: VN_660601_Week_In_Binh_Long.map:12795: missing bridge/ford over minor river at 101,113
ERROR: VN_660630_Srok_Dong.map:2044: missing bridge/ford over minor river at 39,56
ERROR: VN_660630_Srok_Dong.map:2044: missing bridge/ford over minor river at 39,57
ERROR: VN_660630_Srok_Dong.map:2044: missing bridge/ford over stream at 39,57
ERROR: VN_660630_Srok_Dong.map:2044: missing bridge/ford over stream at 40,57
ERROR: XP_580631_PBEM_Set_C01.map:1189: illegal MinorRiverJoinSide at 89,0
WARNING: XP_580631_PBEM_Set_C01.map:1189: missing bridge/ford over stream at 18,47
WARNING: XP_580631_PBEM_Set_C01.map:1189: missing bridge/ford over stream at 19,48
WARNING: XP_580631_PBEM_Set_C01.map:1189: missing bridge/ford over stream at 19,49
WARNING: XP_580631_PBEM_Set_C01.map:1189: missing bridge/ford over stream at 20,49



That "ERROR" in XP_580631_PBEM_Set_C01.map: On inspection, it is in fact innocuous, seeing as the "illegal" MinorRiverJoinSide is at map's edge (and is an artifact of the master-to-submap scenario map creation process).

The other reported ERRORs and WARNINGs are, also on inspection, intentional. They are there for the player, in game, to fix (having engineer units build a bridge, for instance).

csmapchk.pl can be like that: not a few false positives. But, oh, when first tried were there ever so many true positives!



Here are the latest csmapchk.pl reported issues in the CSME map files:



rober@Rob10rto ~/cslint
$ ./csmapchk.pl -nomaster -p -n +w +e -g me
WARNING: AssadLCG_1.map:3: suspicious base -200: -200 50 2 2 0 3 2
WARNING: AssadLCG_10.map:3: suspicious base -200: -200 50 3 3 0 3 2
WARNING: AssadLCG_2.map:3: suspicious base -200: -200 50 3 3 0 3 2
WARNING: AssadLCG_3.map:3: suspicious base -200: -200 50 2 2 0 3 2
WARNING: AssadLCG_4.map:3: suspicious base -200: -200 50 3 3 0 3 2
WARNING: AssadLCG_5.map:3: suspicious base -200: -200 50 3 3 0 3 2
WARNING: AssadLCG_6.map:3: suspicious base -200: -200 50 3 3 0 3 2
WARNING: AssadLCG_7.map:3: suspicious base -200: -200 50 3 3 0 3 2
WARNING: AssadLCG_8.map:3: suspicious base -200: -200 50 3 3 0 3 2
WARNING: AssadLCG_9.map:3: suspicious base -200: -200 50 3 3 0 3 2
WARNING: bnot.map:3: suspicious base -20: -20 25 46 1 2 3 3
ERROR: Deversoir.map:908: illegal elevation 4 at 22,4
WARNING: Duel_For_The_Golan_1985-Banias.map:3: suspicious base -200: -200 50 0 1 0 3 2
WARNING: Duel_For_The_Golan_1985-Bridges.map:3: suspicious base -200: -200 50 1 0 0 3 2
WARNING: Duel_For_The_Golan_1985-Nafakh.map:3: suspicious base -200: -200 50 0 0 0 3 2
WARNING: Duel_For_The_Golan_1985-Night.map:3: suspicious base -200: -200 50 1 0 0 3 2
WARNING: Duel_For_The_Golan_1985-Rafid.map:3: suspicious base -200: -200 50 1 0 0 3 2
WARNING: Duel_For_The_Golan_1985-Valley.map:3: suspicious base -200: -200 50 2 2 0 3 2
WARNING: Duel_For_The_Golan_1985-Valley_A.map:3: suspicious base -200: -200 50 2 2 0 3 2
WARNING: Duel_For_The_Golan_1985-Valley_B.map:3: suspicious base -200: -200 50 2 2 0 3 2
ERROR: EG_731017_Chinese_Farm.map:1510: missing bridge/ford over minor river at 10,15
ERROR: EG_731017_Chinese_Farm.map:1510: missing bridge/ford over minor river at 10,16
[... output omitted for brevity ...]
ERROR: EG_731017_Chinese_Farm.map:1510: illegal LtBridge over gully at 12,47
ERROR: EG_731017_Chinese_Farm.map:1510: illegal LtBridge over gully at 13,48
ERROR: EG_731017_Chinese_Farm.map:1510: missing bridge/ford over gully at 15,27
ERROR: EG_731017_Chinese_Farm.map:1510: missing bridge/ford over gully at 15,28
[... output omitted for brevity ...]
WARNING: Golan Desert.map:3: suspicious base -200: -200 50 1 1 0 3 3
WARNING: IS_731007_Tel_Hermonit.map:3: suspicious base -200: -200 50 2 2 0 3 2
WARNING: IS_731007_Tel_Hermonit_remove.map:3: suspicious base -200: -200 50 0 0 0 3 2
WARNING: IS_731016_Jabah.map:3: suspicious base -200: -200 50 2 1 0 3 2
WARNING: JO_680321_Karameh.map:3: suspicious base -400: -400 50 4 3 0 3 3
WARNING: Mishmar 48.map:3: suspicious base -20: -20 25 46 1 2 3 3
ERROR: Operation Kadesh.map:487: illegal elevation 7 at 1,32
ERROR: Operation Kadesh.map:487: illegal elevation 7 at 9,16
ERROR: Operation Kadesh.map:487: illegal elevation 7 at 16,28
ERROR: Operation Kadesh.map:487: illegal elevation 9 at 17,20
ERROR: Operation Kadesh.map:487: illegal elevation 9 at 21,18
ERROR: Operation Kadesh.map:487: illegal elevation 7 at 21,21
ERROR: Operation Kadesh.map:487: illegal elevation 9 at 22,17
ERROR: Operation Kadesh.map:487: illegal elevation 4 at 25,5
ERROR: Operation Kadesh.map:487: illegal elevation 4 at 26,5
WARNING: SY_670605_Tel_Faher.map:3: suspicious base -200: -200 50 3 2 0 3 2
WARNING: SY_731012_Tel_Masharah.map:3: suspicious base -200: -200 50 4 3 0 3 2
WARNING: XT_820616_Tournament_Set_B01.map:3: suspicious base -200: -200 50 0 0 0 3 2
WARNING: XT_820617_Tournament_Set_B02.map:3: suspicious base -200: -200 50 0 0 0 3 2



Likely, most of those issues are real, are not false positives. We will be sure to make sure before CSME 3.0 is eventually released!

Here are a smattering of issues that csmapchk.pl reported in the CSVN master maps last year (all of them since addressed):



...
ERROR: master_maps/Master_IC_510101_Tonkin.map:16753: illegal elevation 10 at 99,135
ERROR: master_maps/Master_IC_510101_Tonkin.map:16753: illegal elevation 7 at 100,116
ERROR: master_maps/Master_IC_510101_Tonkin.map:16753: illegal elevation 8 at 126,109
ERROR: master_maps/Master_IC_510101_Tonkin.map:16753: illegal WaterBlockSide at 160,121
ERROR: master_maps/Master_IC_510101_Tonkin.map:16753: illegal WaterBlockSide at 160,122
ERROR: master_maps/Master_IC_510101_Tonkin.map:16753: illegal WaterBlockSide at 160,123
...



As I said, early last year, we were aghast to discover thousands of such ERRORs (and WARNINGs).

What about NOTICEs? Here are some of the NOTICEs in the latest CSVN non-master maps:



rober@Rob10rto ~/cslint
$ ./csmapchk.pl -nomaster -p +n -w -e -g vn
NOTICE: IC_511113_HB2_KemPass.map:797: questionable Ford over stream at 23,16
NOTICE: IC_511113_HB2_KemPass.map:797: questionable Ford over stream at 24,15
NOTICE: IC_511113_HB2_KemPass.map:797: questionable Ford over stream at 37,26
NOTICE: IC_511113_HB2_KemPass.map:797: questionable Ford over stream at 37,27
NOTICE: VN_600302_Bec_Trang.map:981: questionable Ford over stream at 26,35
NOTICE: VN_600302_Bec_Trang.map:981: questionable Ford over stream at 26,36
NOTICE: VN_600302_Bec_Trang.map:981: questionable Ford over stream at 27,37
NOTICE: VN_600302_Bec_Trang.map:981: questionable Ford over stream at 28,37
NOTICE: VN_660601_Week_In_Binh_Long.map:12795: questionable Ford over stream at 8,281
NOTICE: VN_660601_Week_In_Binh_Long.map:12795: questionable Ford over stream at 8,282
NOTICE: VN_660601_Week_In_Binh_Long.map:12795: questionable Ford over stream at 17,274
NOTICE: VN_660601_Week_In_Binh_Long.map:12795: questionable Ford over stream at 18,273
[... output omitted for brevity ...]
NOTICE: XP_671231_PBEM_Set_A01.map:1541: questionable Ford over stream at 65,66
NOTICE: XP_671231_PBEM_Set_A01.map:1541: questionable Ford over stream at 66,65
NOTICE: XP_671231_PBEM_Set_A01.map:1541: questionable Ford over stream at 86,54
NOTICE: XP_671231_PBEM_Set_A01.map:1541: questionable Ford over stream at 87,54
[... output omitted for brevity ...]



(In the preceding command, note where WARNINGs and ERRORs were toggled OFF.)

Recall (see above) that maybe 1 in 100 NOTICEs are worth worrying about, and if necessary fixing. Not exactly false positives, but usually of no major concern.

The above is not an exhaustive accounting of all the issues that csmapchk.pl might report. There are still others.

You might see other examples of csmapchk.pl usage in this and other threads. Aplogies that you, the player/modder, cannot yourself run csmapchk.pl (due to lack of encrypt.exe). But hey, we've got things covered!
Campaign Series Legion https://cslegion.com/
Campaign Series Lead Coder https://www.matrixgames.com/forums/view ... hp?f=10167
Panzer Campaigns, Panzer Battles Lead Coder https://wargameds.com
User avatar
berto
Posts: 21461
Joined: Wed Mar 13, 2002 1:15 am
Location: metro Chicago, Illinois, USA
Contact:

Re: CSlint How-To

Post by berto »

cswpnchk.pl


cswpnchk.pl is a Perl script (program) to check weapon.pdt for various errors.

Start by displaying the program help, specifying the Vietnam game:



rober@Rob10rto ~/cslint
$ ./cswpnchk.pl -h -g vn

Usage: cswpnchk.pl [-h|-help] [{+|-}G|-debug] [{+|-}n] [{+|-}w] [{+|-}e] -g[ame] {me|vn|cw|ef|wf|pf}



As you can see, there is not much to do except run a full error report. For CSVN, first just the ERRORs:



rober@Rob10rto ~/cslint
$ ./cswpnchk.pl -n -w +e -g vn
[nil]



No output! ('[nil]' means to say there is no output. In actuality, you would not see that displayed.) This is good! There are no ERRORs in the latest Vietnam Data/weapon.pdt.

As with all CSlint QA check utilities, the options



+|-n show/don't show notices
+|-w show/don't show warnings
+|-e show/don't show errors



are to display, using '+' (plus), or not display (ignore), using '-' (minus)

  • NOTICE -- issues that may or may not be significant, mainly are not; maybe 1 in 100 notices are truly significant; there will be many false positives here!
  • WARNING -- issues that might be significant, but are not showstoppers; maybe 1 in 10 warnings are important
  • ERROR -- showstopper issues, outright errors; except for known false positives, every error will usually be important

Here, for CSME, is some cswpnchk.pl output for that game from a couple of years ago:



rober@Rob10rto ~/cslint
$ ./cswpnchk.pl -n -w +e -g me
ERROR: for unit 83017 Groupement HQ (foot), no corresponding range effect values in weapon.pdt
ERROR: for unit 83018 Groupement Tactique Interarmes HQ (foot), no corresponding range effect values in weapon.pdt
ERROR: for unit 93017 Brigade Battlegroup HQ 48 (foot), no corresponding range effect values in weapon.pdt
ERROR: for unit 93018 Brigade Battlegroup HQ 63 (foot), no corresponding range effect values in weapon.pdt
ERROR: for unit 93019 Battlegroup HQ 63 (foot), no corresponding range effect values in weapon.pdt
ERROR: for unit 223013 Brigade Task Force HQ (foot), no corresponding range effect values in weapon.pdt
ERROR: for unit 223014 Task Force HQ (foot), no corresponding range effect values in weapon.pdt
ERROR: for unit 233013 Regimental Battlegroup HQ (foot), no corresponding range effect values in weapon.pdt
ERROR: for unit 233014 Battlegroup HQ (foot), no corresponding range effect values in weapon.pdt



cswpnchk.pl uses csoobrpt.pl to get a list of unit IDs (and names). It then searches through weapon.pdt for the unit IDs. If it fails to find a unit, it reports the ERROR.

If a firing unit fails to have a weapon.pdt entry, it is potentially a serious issue. In game, if you select such a unit to fire, the Status Bar complains: "Unit is not capable of firing"!

(Note: Even non-firing units will generate ERRORs if absent from Weapon.pdt.)

Here, for CSVN, are some NOTICEs of units in weapon.pdt not found in any of the specified game's platoon*.oob files. Note the '+n' in the following command:



rober@Rob10rto ~/cslint
$ ./cswpnchk.pl +n -w -e -g vn
NOTICE: in weapon.pdt, unknown unit P80051
NOTICE: in weapon.pdt, unknown unit P82122
NOTICE: in weapon.pdt, unknown unit P86516
NOTICE: in weapon.pdt, unknown unit P86518
NOTICE: in weapon.pdt, unknown unit P86521
NOTICE: in weapon.pdt, unknown unit P102058
NOTICE: in weapon.pdt, unknown unit P102059
NOTICE: in weapon.pdt, unknown unit P102060
NOTICE: in weapon.pdt, unknown unit P102061
[... output omitted for brevity ...]



Not terribly important, hence a mere NOTICE. If not in the game's platoon*.oob files, such units will normally not be in use. Still, it is worth purging such useless entries so as to prevent possible glitches and to keep the weapon.pdt neat and tidy.

Another type of NOTICE:



rober@Rob10rto ~/cslint
$ ./cswpnchk.pl +n -w -e -g vn
NOTICE: in weapon.pdt, for unit 6501, range effects don't uniformly decline: h 1 16 8 2 s 5 63 32 10 4 2
NOTICE: in weapon.pdt, for unit 7010, range effects don't uniformly decline: h 55 46 70 66 62 58 55 51 47 43 39 36 s 10 8 7 6 5
NOTICE: in weapon.pdt, for unit 7011, range effects don't uniformly decline: h 55 46 70 66 62 58 55 51 47 43 39 36 s 10 8 7 6 5
NOTICE: in weapon.pdt, for unit 7012, range effects don't uniformly decline: h 55 46 70 66 62 58 55 51 47 43 39 36 s 10 8 7 6 5
NOTICE: in weapon.pdt, for unit 9002, range effects don't uniformly decline: h 48 24 70 66 62 58 55 51 47 43 39 36 s 4 1
NOTICE: in weapon.pdt, for unit 9026, range effects don't uniformly decline: h 48 24 70 66 62 58 55 51 47 43 39 36 s 4 1
NOTICE: in weapon.pdt, for unit 86510, range effects don't uniformly decline: h 1 16 8 2 s 5 63 32 10 4 2
NOTICE: in weapon.pdt, for unit 86512, range effects don't uniformly decline: h 1 16 8 2 s 5 63 32 10 4 2
NOTICE: in weapon.pdt, for unit 86518, range effects don't uniformly decline: h 1 16 8 2 s 5 63 32 10 4 2
NOTICE: in weapon.pdt, for unit 89012, range effects don't uniformly decline: h 36 105 102 99 97 94 91 88 23 21 19 17 s 11 11 11 11 10 10 10 9 9 9 8 8 7 7 6 6
NOTICE: in weapon.pdt, for unit 100037, range effects don't uniformly decline: h 65 49 105 100 95 89 83 77 71 65 59 53 s 24 23 22 21 20 19 18 17 16 15 14 12
[... output omitted for brevity ...]



Usually, range effectiveness diminishes with increasing range. There are exceptions, but usually that is the case. Such errors are often mere typos. (Some weapons are weak to ineffective at close range, reach peak effectiveness two or three hexes away, then diminish in effectiveness farther out.)

cswpnchk.pl might output much detail, output that will probably fill your screen. If it does, you could try piping the output to 'less':



rober@Rob10rto ~/cslint
$ ./cswpnchk.pl +n -w -e -g vn | less



You might see other examples of cswpnchk.pl usage in this and other threads (including further explanation of using awk, sort, uniq, and other Cygwin tools). But the above should be enough to get you started.

If you have questions, just ask here in the Forum.

Good luck! Happy QA (Quality Assurance) checking!
Campaign Series Legion https://cslegion.com/
Campaign Series Lead Coder https://www.matrixgames.com/forums/view ... hp?f=10167
Panzer Campaigns, Panzer Battles Lead Coder https://wargameds.com
User avatar
berto
Posts: 21461
Joined: Wed Mar 13, 2002 1:15 am
Location: metro Chicago, Illinois, USA
Contact:

Re: CSlint How-To

Post by berto »

csutxchk.pl


csutxchk.pl is a Perl script (program) to check unittext.txt entries.

Start by displaying the program help, specifying the Vietnam game:



rober@Rob10rto ~/cslint
$ ./csutxchk.pl -h -g vn

Usage: csutxchk.pl [-h|-help] [{+|-}G|-debug] [{+|-}n] [{+|-}w] [{+|-}e] -g[ame] {me|vn|cw|ef|wf|pf}



As you can see, there is not much to do except specify display of NOTICEs, WARNINGs, and/or ERRORs.

Here are some CSVN csutxchk.pl issues from several years ago (when the game was early in development):



rober@Rob10rto ~/cslint
$ ./csutxchk.pl -n +w +e -g vn
WARNING: for unit 113017 Supply Trucks (HQ), no corresponding unit text in unittext.txt
WARNING: for unit 116819 Armoured Troop Carrier, no corresponding unit text in unittext.txt
WARNING: for unit 116820 Armoured Troop Carrier, no corresponding unit text in unittext.txt
WARNING: for unit 116821 Armoured Troop Carrier, no corresponding unit text in unittext.txt
WARNING: for unit 116822 Yabuta Junks, no corresponding unit text in unittext.txt
WARNING: for unit 118011 SAM Radar, no corresponding unit text in unittext.txt
WARNING: for unit 211092 105mm Howitzers, no corresponding unit text in unittext.txt
WARNING: for unit 211093 M2 105mm Howitzers, no corresponding unit text in unittext.txt
WARNING: for unit 211094 M2 105mm Howitzers, no corresponding unit text in unittext.txt
WARNING: for unit 219039 VC 14.5mm PTRD-41 Anti-Tank Rifle Team, no corresponding unit text in unittext.txt
WARNING: for unit 500001 Type 83 Light Tanks, no corresponding unit text in unittext.txt
[... many more warnings for Thai units ...]



csutxchk.pl uses csoobrpt.pl to get a list of unit IDs (and names). It then searches through unittext.txt for the unit IDs. If it fails to find a unit, it reports a WARNING.

In csutxchk.pl, missing unit text is not terribly serious (the F2 Unit Handbook unit description will be blank), hence that is categorized as just a WARNING, not an ERROR.

Let's see if there are any csutxchk.pl NOTICEs:



rober@Rob10rto ~/cslint
$ ./csutxchk.pl +n -w -e -g vn
NOTICE: for unit text 90001, non-existent unit
NOTICE: for unit text 90002, non-existent unit
NOTICE: for unit text 90003, non-existent unit
NOTICE: for unit text 90004, non-existent unit
[... output omitted for brevity ...]
NOTICE: for unit text 99043, non-existent unit
NOTICE: for unit text 99044, non-existent unit
NOTICE: for unit text 99045, non-existent unit
NOTICE: for unit text 99046, non-existent unit



There are, and so many!

As always, so as not to engulf your terminal display, you might want to pipe csutxchk.pl output to the 'less' command:



rober@Rob10rto ~/cslint
$ ./csutxchk.pl +n -w -e -g vn | less



With csutxchk.pl, "non-existent unit" is not terribly important, hence a mere NOTICE. If not in the game's platoon*.oob files, such units will normally not be in use. Still, it is worth purging such useless entries so as to prevent possible glitches and to keep the unittext.txt neat and tidy.

You might see other examples of csutxchk.pl usage in this and other threads (including further explanation of using awk, sort, uniq, and other Cygwin tools). But the above should be enough to get you started.

If you have questions, just ask here in the Forum.

Good luck! Happy QA (Quality Assurance) checking!
Campaign Series Legion https://cslegion.com/
Campaign Series Lead Coder https://www.matrixgames.com/forums/view ... hp?f=10167
Panzer Campaigns, Panzer Battles Lead Coder https://wargameds.com
User avatar
berto
Posts: 21461
Joined: Wed Mar 13, 2002 1:15 am
Location: metro Chicago, Illinois, USA
Contact:

Re: CSlint How-To

Post by berto »

cssndchk.pl


cssndchk.pl is a Perl script (program) to error check sounds.dat, the sound files (.ogg, perhaps also any .wav), also the sounds related parameters in the platoon OOB files.

Start by displaying the program help:



rober@Rob10rto ~/cslint
$ ./cssndchk.pl -h

Usage: cssndchk.pl [-h|-help] [{+|-}G|-debug] [{+|-}n] [{+|-}w] [{+|-}e] -g[ame] {me|vn|cw|ef|wf|pf}



As you can see, there is not much to do except run a full error report. For CSVN:



rober@Rob10rto ~/cslint
$ ./cssndchk.pl +n +w +e -g vn
ERROR: sounds.dat:1: missing 0weapon5.ogg file
ERROR: sounds.dat:1: missing 0weapon6.ogg file
NOTICE: sounds.dat:1: for type 4, 6 weapon files, but in sounds.dat only 5 are registered
ERROR: sounds.dat:1: missing 5weapon3.ogg file
ERROR: sounds.dat:1: missing 10weapon2.ogg file
ERROR: sounds.dat:1: missing 22weapon1.ogg file
ERROR: sounds.dat:1: missing 23weapon1.ogg file
ERROR: sounds.dat:1: missing 0explosion5.ogg file
ERROR: sounds.dat:1: missing 0explosion6.ogg file
ERROR: sounds.dat:1: missing 5explosion3.ogg file
ERROR: sounds.dat:1: missing 10explosion2.ogg file
NOTICE: sounds.dat:1: for type 22, 1 weapon files, and 2 explosion files
NOTICE: sounds.dat:1: for type 23, 1 weapon files, and 2 explosion files
ERROR: sounds.dat:2: missing 0movement5.ogg file
ERROR: sounds.dat:2: missing 0movement6.ogg file
ERROR: sounds.dat:2: missing 0movement7.ogg file
ERROR: sounds.dat:2: missing 1movement4.ogg file
ERROR: sounds.dat:2: missing 1movement5.ogg file
ERROR: sounds.dat:2: missing 3movement2.ogg file
ERROR: sounds.dat:2: missing 3movement3.ogg file
ERROR: sounds.dat:2: missing 4movement1.ogg file
ERROR: sounds.dat:2: missing 4movement2.ogg file
ERROR: sounds.dat:2: missing 6movement1.ogg file
ERROR: sounds.dat:2: missing 6movement2.ogg file
ERROR: sounds.dat:2: missing 8movement1.ogg file
ERROR: sounds.dat:2: missing 8movement2.ogg file
ERROR: sounds.dat:3: missing assault8.ogg file
ERROR: sounds.dat:3: missing assault9.ogg file
ERROR: sounds.dat:3: missing assault10.ogg file



Oh! That's unexpected! WTF?!

Those are the actual results we saw in a recent cssndchk.pl run. We subsequently discovered that due to a production error, an older set of Sounds files were somehow included in the latest install set. After emptying the Sounds folder and replacing them with the sound files from the previous official CSVN v1.11 public install, we then got the results:



rober@Rob10rto ~/cslint
$ ./cssndchk.pl +n +w +e -g vn
NOTICE: sounds.dat:1: for type 4, 6 weapon files, but in sounds.dat only 5 are registered



That NOTICE is something for us to look into. But by use of cssndchk.pl, we are confident that the latest set of Sounds files (also the other things that cssndchk.pl reviews) check "good enough" cleanly. (And we are reassured that the Sounds files in the latest official public release are generally fine.)

Let's check the latest CSME Sounds files:



rober@Rob10rto ~/cslint
$ ./cssndchk.pl +n +w +e -g me
NOTICE: sounds.dat:1: for type 3, 6 weapon files, but in sounds.dat only 5 are registered
NOTICE: sounds.dat:1: for type 4, 6 weapon files, but in sounds.dat only 5 are registered
NOTICE: sounds.dat:1: for type 16, 4 weapon files, but in sounds.dat only 3 are registered
NOTICE: sounds.dat:1: for type 22, 1 weapon files, and 2 explosion files
NOTICE: sounds.dat:1: for type 23, 1 weapon files, and 2 explosion files
NOTICE: sounds.dat:2: for type 22, 1 movement files, but in sounds.dat only 0 are registered
NOTICE: sounds.dat:3: 8 assault files, but in sounds.dat only 7 are registered
NOTICE: sounds.dat:4: 6 xbackg files, but in sounds.dat only 3 are registered
NOTICE: sounds.dat:4: 11 backg files, but in sounds.dat only 8 are registered
NOTICE: sounds.dat:4: 17 nbackg files, but in sounds.dat only 3 are registered



It looks bad, but because NOTICEs, nothing urgently worrisome. Mainly, it seems we have some unnecessary extra Sounds files, else we need to edit Sounds.dat. We will be sure to fix those and any other issues before the next CSME release.

The above is not an exhaustive accounting of all the issues that cssndchk.pl might report. There are still others.

You might see other examples of cssndchk.pl usage in this and other threads. But the above should be enough to get you started.

If you have questions, just ask here in the Forum.

Good luck! Happy QA (Quality Assurance) checking!
Campaign Series Legion https://cslegion.com/
Campaign Series Lead Coder https://www.matrixgames.com/forums/view ... hp?f=10167
Panzer Campaigns, Panzer Battles Lead Coder https://wargameds.com
User avatar
berto
Posts: 21461
Joined: Wed Mar 13, 2002 1:15 am
Location: metro Chicago, Illinois, USA
Contact:

Re: CSlint How-To

Post by berto »

csoobchk.pl


csoobchk.pl is a Perl script (program) to error check order of battle (.oob) files

Start by displaying the program help:



rober@Rob10rto ~/cslint
$ ./csoobchk.pl -h

Usage: csoobchk.pl [-h|-help] [{+|-}G|-debug] [{+|-}n] [{+|-}w] [{+|-}e] -g[ame] {me|vn|cw|ef|wf|pf} [-f <oob file>]



As you can see, there is not much to do except run a full error report. For CSCW (Campaign Series: Cold War, a game not yet released):



rober@Rob10rto ~/cslint
$ ./csoobchk.pl +n +w +e -g cw
ERROR: Corps10.oob:70: unknown division D1242745 ROK 1st Division - (ROK changes every month)
ERROR: Corps10.oob:77: unknown division D1242750 ROK 1st Division - (ROK changes every month)
ERROR: Corps10.oob:84: unknown division D1242757 ROK 1st Division - (ROK changes every month)
ERROR: Corps10.oob:91: unknown division D1242765 ROK 1st Division - (ROK changes every month)
ERROR: Corps10.oob:98: unknown division D1242775 ROK 1st Division
ERROR: Corps10.oob:146: unknown division D1242785 ROK 1st Division
ERROR: Corps10.oob:153: unknown division D1242795 ROK 1st Division
ERROR: Corps10.oob:190: unknown division D1242796 ROK 2nd Division - ROK changes every couple months
ERROR: Corps10.oob:198: unknown division D1242806 ROK 2nd Division - ROK changes every couple months
ERROR: Corps10.oob:206: unknown division D1242816 ROK 2nd Division - ROK changes every couple months
ERROR: Corps10.oob:214: unknown division D1242826 ROK 2nd Division - ROK changes every couple months
ERROR: Corps10.oob:234: unknown division D1242835 ROK 1st Division
ERROR: Corps10.oob:235: unknown division D1242841 ROK 8th Division
ERROR: Corps10.oob:236: unknown division D1242842 ROK 9th Division
ERROR: Corps10.oob:256: unknown division D1242834 ROK Capital Division
ERROR: Corps10.oob:257: unknown division D1242836 ROK 2nd Division
ERROR: Corps10.oob:258: unknown division D1242837 ROK 3rd Division
ERROR: Corps10.oob:273: unknown division D1242847 ROK 1st Division
ERROR: Corps10.oob:278: unknown division D1242846 ROK Capital Division
ERROR: Corps10.oob:279: unknown division D1242849 ROK 3rd Division
ERROR: Corps10.oob:280: unknown division D1242854 ROK 9th Division
ERROR: Corps10.oob:294: unknown division D1242224 ROK 1st Division
ERROR: Corps10.oob:321: unknown division D1242224 ROK 1st Division
ERROR: Corps10.oob:334: unknown division D1242224 ROK 1st Division
ERROR: Regiment08.oob:2161: unknown battalion B1112329 1er VNA Motorized Infantry Battalion 48 - Muong - B
ERROR: Regiment08.oob:2247: unknown battalion B1112331 VNA Bataillon de Marche du RCC - BMRC 50 - B
ERROR: Regiment08.oob:2378: unknown battalion B1112329 1er VNA Motorized Infantry Battalion 48 - Muong - B
ERROR: Regiment08.oob:2379: unknown battalion B1112329 2e VNA Motorized Infantry Battalion 48 - Muong - B
[... output omitted for brevity ...]



By default, csoobchk.pl will check every .oob file (in the OOBs folder). You can also check just one file, for example:



rober@Rob10rto ~/cslint
$ ./csoobchk.pl +n +w +e -g cw -f Regiment08.oob
ERROR: Regiment08.oob:2161: unknown battalion B1112329 1er VNA Motorized Infantry Battalion 48 - Muong - B
ERROR: Regiment08.oob:2247: unknown battalion B1112331 VNA Bataillon de Marche du RCC - BMRC 50 - B
ERROR: Regiment08.oob:2378: unknown battalion B1112329 1er VNA Motorized Infantry Battalion 48 - Muong - B
ERROR: Regiment08.oob:2379: unknown battalion B1112329 2e VNA Motorized Infantry Battalion 48 - Muong - B
[... output omitted for brevity ...]



At present, csoobchk.pl does not check much in the Platoon*.oob files. (We rely more on cslint, https://www.matrixgames.com/forums/view ... 0#p4988610, for that purpose.) csoobchk.pl is far more useful for spotting issues in the other .oob files.

The above is not an exhaustive accounting of all the issues that csoobchk.pl might report. There are still others.

You might see other examples of csoobchk.pl usage in this and other threads. But the above should be enough to get you started.

If you have questions, just ask here in the Forum.

Good luck! Happy QA (Quality Assurance) checking!
Campaign Series Legion https://cslegion.com/
Campaign Series Lead Coder https://www.matrixgames.com/forums/view ... hp?f=10167
Panzer Campaigns, Panzer Battles Lead Coder https://wargameds.com
Post Reply

Return to “Scenario Design and Modding”