Hey everyone. In the past I’ve wanted to make changes in a module’s structure or add some features that make it more fun to play - like automating certain repetitive game features, or adding new Layer’s to every piece… Until now, I’ve had to do it manually in the editor or (dread the thought) open up the module and edit the buildFile by hand (gasp of horror).
This has stopped me from making changes to modules I enjoy playing and has stopped me from playing some modules I would want to play but they are too many changes needed to make the module fun to use (think Divine Right).
What I want is the power of a scripting language that give tools like regular expressions and functions to be able to automate a series of changes to a module - and then save it - and to have the safety of VASSAL’s own type system to stop me from making a hash of editing by hand.
Enter vassal-python (module: vassal-python · PyPI, source: GitHub - jasonestewart/vassal-python: tools for manipulating vassal modules in python) into the fray! It is still early days but it already does some pretty nice stuff and more is coming.
For example, one of the included applications will print a formatted list of all the game pieces in the module:
$ python3 module-print.pl --mod test.vmod VASSAL: initGameModule: start ... [SNIP: vassal-pyton startup messages] VASSAL: initGameModule: end USA Union Army of West Virginia Commander Crook, AWV Thoburn's Division, 1/AWV Thoburn's Division, 1/AWV Thoburn 1/AWV 1/AWV Brigades Wells, 1/1/AWV Wells 1/1/AWV Wells Rgmt 1 Wells Rgmt 2 Wells Rgmt 3 Wells Rgmt 4 Wells Rgmt 5 Ely, 2/1/AWV [SNIP: more output] Success!
Also, there is an application that enables scraping of numbers off the images of game piece counters and a second that takes the output of the scraper and adds markers to every unit and uses that scraped data as the state of the marker. The image scraper will ask for confirmation if it doesn’t have sufficient confidence in the guess. It will pop up an image window showing what it scraped and what it’s best guess of the number is. Click on the image window and hit enter to make it go away and then back in the shell window, hit enter to use the default value or type in a new value and hit enter to continue.
$ python3 image-scrape.py --image-dir ./images --names-file names.txt --ss-file start-str.txt Reading image: 14IN_front.png Found strength: 9 Reading image: 14INa_front.png Found strength: 5 Reading image: 14INb_front.png Found strength: 4 Reading image: 8OH_front.png Found strength: 14 Reading image: 8OHa_front.png ss_10: 7, ss_8: NONE>> 7 ...[SNIP: interactively prompts user for confirmation] enter correct strength: >> 7: Found strength: 7 ...[SNIP: more output] Success! $ python3 add-starting-strengths.py --mod file.vmod --ssfile starting-strengths.txt VASSAL: initGameModule: start ...[SNIP: vassal-pyton startup messages] VASSAL: initGameModule: end Piece: 34MA_8_front.png Found SS for piece: 34MA_8_front.png, strength: 8 Piece: 5NY_HA_12_front.png Found SS for piece: 5NY_HA_12_front.png, strength: 12 Piece: 116OH_10_front.png Found SS for piece: 116OH_10_front.png, strength: 10 Piece: 123OH_10_front.png Found SS for piece: 123OH_10_front.png, strength: 10 Piece: 170OH_front.png Found SS for piece: 170OH_front.png, strength: 8 Piece: Ely_front.png Piece: 1WV_2_1_AWV_front.png Found SS for piece: 1WV_2_1_AWV_front.png, strength: 8 Piece: 4WV_front.png Found SS for piece: 4WV_front.png, strength: 8 Piece: 12WV_2_1_AWV_front.png Found SS for piece: 12WV_2_1_AWV_front.png, strength: 8 Piece: 18CT_2_1_AWV_front.png Found SS for piece: 18CT_2_1_AWV_front.png, strength: 8 Piece: 2MD_ES_front.png Found SS for piece: 2MD_ES_front.png, strength: 8 Piece: Young's_PB_front.png Found SS for piece: Young's_PB_front.png, strength: 8 ...[SNIP: more output] Success!
Let me know here, or on github what works, what doesn’t and what features are needed. Enjoy your module mangling!
This is alpha code. Make a copy of your module before you feed it into the applications based on this package. Check your changes in the editor after you’ve made them. You’ve been warned.