Page 1 of 1

GURPS - GCA4 to JSON conversion script (Python)

Posted: Sat Nov 17, 2012 8:59 pm
by joshsziegler
Script: ...
Sample Output:
Python version: 2.6 or 2.7
  • Reads in all GCA4 key-values (I think) and saves them as JSON (i.e. {"character_name": {"section_name": {"line_name": {"key": "value"}}}}).
  • Can condense output file if needed via variable (pretty print).
  • Can skip whole sections and/or individual keys using the skip lists.
I wrote a combat tracker/die roller website for my GURPS group and wanted to quickly update their stats directly from the GCA4 files, so this is what I came up with. Previously I used regex to pull out the exact values I needed, but that quickly grew unwieldy as my website added features (and thus needed more data). This sticks to the original GCA4 key names, but is more flexible overall. I might add a key renaming feature later on if that proves useful.

This is obviously kludge-tastic and likely has bugs. Feel free to let me know about those and any improvements you'd like to see. For example, I haven't tried to load this into MapTool (haven't really used maptool lately :\ ), so help there would be good. Especially if I need to change the format of things.