Python tools for manipulating VASSAL modules
Project description
VASSAL Python
Tools for manipulating VASSAL module files using python
Implemented using jpype
The successor to VASSAL::Perl
Components
The package implements the following modules for working with VASSAL game modules
Manager
The class that wraps a headless version of the VASSAL so that it is possible to call all the module loading, parsing, and saving features without a Swing GUI.
from python.vassal.manager import Manager
manager = Manager()
gameModule = manager.open_module("./test.vmod")
Walker
The class that enables recursive descent into the Buildables hierarchy of a game module and enables printing or actions on pieces and components.
from python.vassal.manager import Manager
from python.vassal.walker import Walker
manager = Manager()
gameModule = manager.open_module("./test.vmod")
walker = Walker(gameModule)
walker.print_game_module_pieces()
Loading the JVM
Jpype needs the JVM started before it can begin loading the Java classes. This is handled inside manager.py during the module loading. The JVM needs to find both Vengine.jar
and Helper.class
in the classpath. One easy way to do that is to set the classpath using jpype before loading manager.py
import jpype
import jpype.imports
jpype.addClassPath("./lib/Vengine.jar")
jpype.addClassPath("classlib/") # Helper.class
from python.vassal.manager import Manager
Example Applications
- module-print.py: recursively prints the names of all the piece windows and the pieces in each window
- add-starting-strengths.py: compares the name of each piece in the module to a predefined list of piece names, and if found, creates a new "StartingStrength" trait on the piece and sets the value to that listed in the file
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for vassal_python-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac37cca14e39ac6d6f18023d78725117f1800d6ec75c0291d5ee331791afc672 |
|
MD5 | 679b41748337027dc43fd8416b8242ca |
|
BLAKE2b-256 | a283326d12c5de5786344bf7a14a09af7878dd649c1aecb498de4d0cef1fc764 |