Skip to main content

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 Distribution

vassal-python-0.2.0.tar.gz (5.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vassal_python-0.2.0-py3-none-any.whl (5.2 MB view details)

Uploaded Python 3

File details

Details for the file vassal-python-0.2.0.tar.gz.

File metadata

  • Download URL: vassal-python-0.2.0.tar.gz
  • Upload date:
  • Size: 5.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for vassal-python-0.2.0.tar.gz
Algorithm Hash digest
SHA256 72ece730fe696b4ca0ed28ed68d784b3432c89dc8ff19e1cc987f502397a5f98
MD5 954073f52c3b3b666f493d6b6d0ff8d5
BLAKE2b-256 2cefcbee0820f0652402dfb1cdfbf4059c6edf0e06c5cf5a346e584049928bfa

See more details on using hashes here.

File details

Details for the file vassal_python-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: vassal_python-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.2 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for vassal_python-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 087f67141ebf481fa39359d42fbdd305620a3f9b0a89087d03e2c188671f6b42
MD5 7ca7c10612d59f342262a8a53bdcc321
BLAKE2b-256 20848e32e48dc94ab596fcb7849376578524a522fcb2bff9e8dadeb8a77ec418

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page