Duplicate setup (vsav) for all boards

My module has 4 boards, and will probably have more added later. The setup when starting the game will always be identical though (or at least I think so; may add some special setups later). I started a game on one of the boards, set up all the pieces, saved to a VSAV, added that as a default setup config to choose from when starting the game. All good so far, but now I want the exact same set up for the other three boards. It’s a bit tedious to manually set everything up three more times.

Not sure what options there are. Maybe at-start stacks on the map would have been better, as those will apply to all boards (right?). But setting those up seemed to be a lot of work for over 100 pieces, each one in its own stack (so create and re-position each stack and add a piece to it)? If there is no easier way?

Would be great, I think, to convert my set up to at-start stacks, but I do not find any button for that?

I think your suggestion to use At-Start Stack may be a better option if the pieces all start in the same location no matter what.

At-Start Stack can be tied to a specific board (Belongs to board), or to the map in general. However, if you enable Use grid location, and set the location in Location, then you should make sure that location (LocationName or $gridLocation$) is valid in all possible boards.

If not, then you could hack your .vsav for example using the Python module pywargame. You could also use that Python module to write the .vsavs - see for example the script vsavwrite.py which takes a dictionary (as JSON) of pieces and locations as well as a module file, and creates a new .vsav file. The dictionary can be generated from a spreadsheet or the like. With a bit of coding, you could take your existing .vsav, extract a dictionary from that, and then change it appropriately so make a new input dictionary. Of course, this requires a bit of Python skill.

Yours,
Christian

You could also use the script vsavpatch.py to simple replace the board settings in one .vsav with other boards in the output .vsav - Again, assuming the boards are compatible in terms of pixel locations, and a bit of Python skill.

Yours,
Christian

Thans for the links!

Without waiting for answers I just pushed ahead and set up two more maps manually. The fourth one was not all that interesting, so I am done for now, but this may be useful to know if I get around to add more maps later.

I actually wrote a python script yesterday to generate the map grid for this game. It’s a bit special, but very regular, so a short script was perfect to generate a SVG map. That means I already have a script that has all the coordinates where I need the setup units to go, so theoretically maybe I could use some of those linked modules to create or modify a VSAV? Or, since I already have the setup, maybe it is easier to write a new script to read the VSAV file and replace the map board SVG (they are really all very similar, just the same basic empty grid with different river configurations painted on; there may be other possibilities like adding the rivers as overlay “pieces” that can be added to the save files).

With the Python module pywargame you can manipulate the module or saves. There are some utility scripts that allows you to pass a patch script to patch a module or save. See some of the modules I did.

Yours,
Christian

For example, suppose you have the save Save.vsav, and the module Module.vmod. In the save file, you have picked boards A and B on map Map. If you then you can create the Python script patch.py, with the content

from pywargame.vassal import * 

def patch(lines,key,save_meta,module_meta,verbose):
    newlines = []
    for line in lines: 
        if line.startswith('MapBoardPicker'): 
            newlines.append(line.replace('\tA','\tC').replace('\tB','\tD'))
        else:
            newlines.append(line)
    
    return newlines

you can do

$ cp Save.vsav New.vsav
$ vsavpatch.py New.vsav patch.py

and the boards A and B will be replaced with C and D, respectively, in New.vsav.

Yours,
Christian