Storing previous/any DeckName?

I’m currently using version 3.2.16

I’m working on my own modifications to the Star Wars Epic Duels module (SWED 3.2) and I’ve hit a point where I can’t think of a way to do what I need to do. The decks in the original were not able to be sent wherever you wanted them to, they could only be sent to one deck that was specified in the Properties menu and that was it. I found a way around that using the “Send To Deck” function with various hotkeys firing off. The next feature I’m trying to add is sending a deck currently on the main map back to the private window where the decks are initially stored. I don’t want it sent just anywhere in that window, I need it to go to the specific deck that it was sent from. This is where I’m stuck.

After about 6 hours of trial and error, I’m at a point where I realized that what I need is a way to access the first DeckName that these cards started in, store it in a variable and then recall that variable later when I need to send it back. As far as I can tell, the only relevant property I can access is DeckName, but it is continuously updated as my cards change decks so it’s useless.

Any help at all is appreciated.

I assume that each individual card always needs to go back to the same place whenever this happens? If so, do the following:

  • To each card, add a new “Return to Deck” trait.

  • You probably want to blank out the command name (You don’t want this as a right click menu option on each individual card, right?)

  • Give the Return-to-Deck trait a Named Keystroke – in Paths of Glory I use “To Setup”.

  • Use the “Select Deck” button to set the deck that the card goes to.

  • You can then use the copy/paste functions to copy this trait to all the other cards in the deck that go to the same place. And then cards that go to a different deck get the same thing, except with the Select-Deck set to the different deck. In Paths of Glory I did this by making Global Prototypes for each kind of card (so CP Mobilization cards got the prototype CardCP_MO, and Limited War and Total War cards got the prototypes CardCP_LW and CardCP_TW, and then Expansion cards got CardCP_EX – and each prototype just contained the version of ToSetup that sent the card to the right place, and so then I could put Prototype traits in the individual cards and they would know where to go).

  • Now, when you want to send cards back to their setup spot, you just need to use a Global Key Command that sends them a “ToSetup” as the keystroke. If you send this without any “matching expression” then every card in the game will go back to wherever its ToSetup trait tells it to go (and anything that doesn’t have a ToSetup won’t go anywhere).

  • Or you can use a matching expression to send only certain cards back.

Hopefully this gets you going in the right direction!

If you want to see this in action, you can load Paths of Glory 9.7. Which is a bit complicated of a module, but if you load up a scenario, select any piece, and hit Alt+Ctrl+Shift+D it will send every card in the game to the discard pile, and then Alt+Ctrl+Shift+S will send every card back to its startup deck (so Expansion cards to off-screen to the expansion window, and Mobilization/LW/TW cards go in their respective decks on the main screen). In the Game Piece Prototype definitions, you can look at the various Card prototypes to see the card details. The individual cards themselves are defined on the Map in the Decks which are pretty early in the list (and the Expansion cards on the separate window defined way down at the bottom of the module). The Global Key Commands are on the Map page a few entries up from the Decks – I’m issuing them essentially “from the toolbar” because I only use these when setting up a scenario but you can issue your GKC’s from any piece.


Thanks a lot for the reply. I was afraid that I was going to have to do it this way, card by card. I figured I could do what you did with specific prototypes and various RTD functions, but I was hoping there was a way around that. If only we could store the initial deck in a constant variable that could be determined automatically by a card in that deck. Looks like I better get to work on that. Thanks for the advice!

Also, another quick question: is it possible to use the “Edit all contained pieces” function in a deck to add a prototype to all the cards without changing every single card to the exact same thing? Whenever I used that function, every card just became the same image. Can we somehow just apply one trait to all cards while retaining their uniqueness?

I usually do this:

  • Add the trait I want to one card
  • Select that trait and press “Copy” button
  • Bring up the other cards one by one and hit “Paste”
  • NOTE - this is one of the main reasons to use a prototype, so you’re cut/pasting the Prototype into all the cards one time, but then you can edit the two-or-three different prototypes later to make changes across all cards.

Thanks, Cattle! Unfortunately for me, that’s the way I’ve been doing it so far. I was just wondering if there was a quick way to add a trait to all cards with that function without it also overwriting everything and making them copies of the first card. There really isn’t an easy to way to do much of anything in Vassal, is there? Haha

Vassal definitely needs some shortcuts and more flexible features like this.

It would be fairly easy to automate the process by directly editing the buildFile (outside of the VASSAL editor), but that, of course, could easily end up completely messing up the module if you make a mistake.

I’ve never looked into that as I just started my Vassal module editing a few days ago. I’m guessing I would need to learn a programming language, or at least the relevant functions to make a script for that?

No need to learn a language (even a scripting one), but whether buildFile editing “is for you” does depend on what general level of hacking-around-with-files confidence you bring to the table. :slight_smile:

The buildFile is really just an “xml” file (text file with lots of html-style tags in it). Since you .vmod file (the module) is really just a “zip” file, you can rename it from .vmod to .zip and then access it like a zip file – pull the buildFile out, edit in a text editor (I use XMLSPY for maximum power, but honestly even NotePad or something like that will do the trick), and then you plop the buildFile back in over top of the old one, rename the .zip back to .vmod and away you go.

If that sounds tempting (or you want to at least experiment and poke around) then believe me PLEASE back up your whole module first. It’s easy to wipe a bunch of your work or render it all inoperative with a mistake.

I do use XMLSPY editing to do certain kinds of fixes – e.g. duplicating a whole bunch of something, or global-search-and-replace types of things – it certainly has its uses. But decide how strong your stomach is before you plunge in! :smiley:

I think I could get into doing that if I can make myself a few time saving shortcuts. I have no problem tearing it apart and experimenting a little on a disposable version. I learn better that way anyway. Thanks for the idea, that sounds awesome.

So after looking through the build file, I figured out what everything was and changed what I needed to. My question now is how do I actually turn all of this back into the module? I tried just zipping the whole folder again and then changed the extension back to .vmod and it looks fine. When I go to run it, I get my usual prompt to allow it, but the program never actually opens.

Did I miss a step here? I don’t think what I edited should have broke it since all I did was add a prototype definition to every deck using Replace All. I’m pretty sure I only applied it to the cards and nothing else in the file was messed up.

Nevermind, I messed up when rezipping the folder. Dumb mistake. I have a new issue with my edited buildFile though, so I started a new topic.