GURPS - GCA4 to JSON conversion script (Python)

Show off your RPG maps, campaigns, and tokens. Share your gaming experiences and stories under General Discussion and save this forum for things you've created that may help others run their own games. Use the subforums when appropriate.

Moderators: dorpond, trevor, Azhrei, Gamerdude

Post Reply
User avatar
joshsziegler
Cave Troll
Posts: 38
Joined: Mon May 17, 2010 10:04 pm

GURPS - GCA4 to JSON conversion script (Python)

Post by joshsziegler »

Script: https://raw.github.com/joshsziegler/cha ... to_json.py
Sample Output:
Python version: 2.6 or 2.7
Features:
  • 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.
Background:
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.

Post Reply

Return to “User Creations”