Jump to content
IGNORED

Tool: Python script for gnerating overlays.json


Recommended Posts

This is a quick Python program to generate overlays.json and the corresponding translation file. Rationale here is that Python is a lot more forgiving of syntax errors than JSON, and it has way better diagnostics, while (once you get the data structure right), it's JSON output is flawless.

 

Also, there are only really two fields that change from one entry to the next, so you can reduce the entire thing to a list of names. As an example, this is the list for the tats I've been making to brand raider bosses with their names on their ass cheeks.

 

#
# this is the list that drives the whole thing
#
# filename will be used for the overly id as well as the materials file
#
tats = [
	# "file name", "name as you want it to appear in the menu"
	( "ack_ack", "Ack Ack" ),
	( "bedlam", "Bedlam" ),
	( "big_maude",	"Big Maude" ),
	( "bridget",	"Bridget" ),
  # etc...
]

 

So you'd want to change that to match the ids and names of your overlays.

 

There's also three variables that you'll want to set:

 


#
# change this to point at the overlays folder for your mod
#
Overlay.directory = "overlays\\docclox\\"

#
# this is the prefix for ids ("rss_foo_bar") and also for the translations ("$RRS Foo Bar")
#
# use lower case
#
Overlay.prefix = "rrs"

#
# name of the translaton file
#
translation_file = "raiders_reform_school_names_en.txt"

Run that and you'll get an overlays file that looks like this:
 

Spoiler

 


[
 {
  "sort": 0,
  "transformable": false,
  "name": "$RRS Ack Ack",
  "gender": 1,
  "slots": [
   {
    "slot": 3,
    "material": "overlays\\docclox\\ack_ack.BGEM"
   }
  ],
  "id": "rrs_ack_ack",
  "playable": true
 },
 {
  "sort": 0,
  "transformable": false,
  "name": "$RRS Bedlam",
  "gender": 1,
  "slots": [
   {
    "slot": 3,
    "material": "overlays\\docclox\\bedlam.BGEM"
   }
  ],
  "id": "rrs_bedlam",
  "playable": true
 },

#etc

]

 

 

 

 

And you'll get a translation file that looks like this:

 

$RRS Ack Ack	RRS Ack Ack
$RRS Bedlam	RRS Bedlam
$RRS Big Maude	RRS Big Maude

and so on.

 

I made it for my sanity. Decided to share it in case it helps someone else. I hope someone finds it useful.

gen_overlay.py

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...