Dealing cards from a deck into multiple other decks

I have a game with 4 decks. At the start of the game, a particular number of cards are dealt from deck 4 to decks 1, 2, and 3, each of which then needs to be reshuffled, and the rest of deck 4 is “put back into the box.” Note that all four decks’ cards have the same backs, so that isn’t a problem. Is there a way to do this automatically at the start of a game?

Look into

The sequence will be something like

  • The SGKC triggers on On First Game Launch/Load Of Session and sends the key-command to the MAB
  • The MAB triggers 3 MGKC each of which triggers a DSKC in deck 4
    • The 3 DSKC each sends three cards to one of the three decks 1, 2, and 3
  • The MAB then sends 3 “shuffle” commands to decks 1, 2, and 3
  • And finally, the MAB sends a command to deck 4 to empty that deck.

A little more detail:

  • SKGC

    • When: On First Game Launch/Load Of Session
    • Command: initialDeal
  • MAB

    • Hotkey: initialDeal
    • Entries: [Deal to 1,Deal to 2, Deal to 3,Shuffle 1,Shuffle 2,Shuffle 3,Empty 4]
  • MGKCs

    • Command: Deal to 1
      • Key: dealTo1

    • Command: Shuffle 1
      • Key: shuffle1

    • Command: Empty 4
      key: returnToBox
      filter: {Deck=="Deck4"} (check this logic - probably not right)
      apply to: All cards in deck
  • Decks

    • Deck4

      • DSCKs
        • key: dealTo1
          • Target: Deck1
          • Limited: True
          • Limit: 3

    • Deck1

      • Re-shuffle key: shuffle1
  • Cards:

    • SendtoTrait:
      key: returnToBox
      location: …

I think that should do the trick.

Yours,
Christian

Thanks for the tips. I do have two more questions:

  1. I want to discard the cards “back into the box.” What I did was, I created a deck that is located outside of the bounds of the map, and send the cards to there. Is that the way to do this, or is there an easier / preferred way?

  2. I can’t get a Deck Send Key Command to take a Global Property as a “Maximum Number of Cards to Send” value. When I use a constant (e.g. {4}), then it works as intended (i.e. four cards are moved to the target deck), but when I define a Global Property (e.g. property name P1, value 4, Numeric) and set the Maximum Number of Cards to Send to {P1}, it throws “Bad Data in Module: Source: {P1} Error: Send Card To Deck 1[Deck Send Key Command]: Editor.Editor.DeckSendKeyCommand.error_invalid_send_limit”, and it sends all of the cards from the source deck to the target deck. Note that it does the same thing if I use a property name that does not exist. Does anybody have any idea what it is supposed to be?

It would be better to place the deck on a separate, hidden map; having objects outside the map bounds can cause drawing issues, although those seem to be rare. Alternatively, if you’re certain there’s no need to ever reference the cards again once they’re discarded, you can instead use the Delete trait to completely remove them from the game.

As for your second issue, are you certain your Global Property is in scope; i.e., it’s defined at the global level and not at the map or zone level?

I would agree with @jrwatts - put the “Box” deck you want to send to on another map (say Box), and then send them there. That deck should disallow drawing any cards from it. Or, just delete them completely (replace the SendtoTrait above with a DeleteTrait.)

Please consider How to format posts, and perhaps also post the errorLog as detailed in How to report problems. Also, it would be helpful if you could make the module available. The log can tell us if the property P1 is known or not.

Perhaps consider to make P1 a numeric Scenario option. In that way, users can choose it when starting the game. Of course, that means that you shouldn’t use a SGKC but trigger the MAB directly (possibly by a Turn Tracker). The MAB should then be disabled afterwards.

Yours,
Christian

Here are the details:

The module is at:
www.thatdonsoftware.com/Freedom_TheUndergroundRailroad.vmod
Right-click on the deck in the upper left corner of the map, then select “Send Card to Period 1 Deck”

VASSAL 3.7.16
Windows 11 Professional
JRE SE build 22.0.1+8-16)

Error Log:

2025-05-16 10:28:57,247 [19656-SwingWorker-pool-1-thread-5] INFO  VASSAL.launch.AbstractLaunchAction - Loading module file C:\VASSAL Modules\Freedom_TheUndergroundRailroad.vmod
2025-05-16 10:28:57,303 [19656-SwingWorker-pool-1-thread-5] INFO  VASSAL.launch.TilingHandler - No images to tile.
2025-05-16 10:28:57,303 [19656-SwingWorker-pool-1-thread-5] INFO  VASSAL.launch.AbstractLaunchAction - Loading module Freedom: The Underground Railroad
2025-05-16 10:28:57,303 [19656-SwingWorker-pool-1-thread-5] INFO  VASSAL.launch.AbstractLaunchAction - JVM maximum heap size: 1024 MB
2025-05-16 10:28:57,304 [19656-SwingWorker-pool-1-thread-5] INFO  VASSAL.tools.io.ProcessLauncher - launching C:\Program Files\VASSAL-3.7.16\jre\bin\java -Xms1024M -Xmx1024M -Duser.home=C:\Users\donpd -Duser.dir=C:\Program Files\VASSAL-3.7.16 -cp lib\Vengine.jar VASSAL.launch.Player --load -- C:\VASSAL Modules\Freedom_TheUndergroundRailroad.vmod
2025-05-16 10:28:57,746 [3960-main] INFO  VASSAL.launch.StartUp - Starting
2025-05-16 10:28:57,754 [3960-main] INFO  VASSAL.launch.StartUp - OS Windows 11 10.0 amd64
2025-05-16 10:28:57,754 [3960-main] INFO  VASSAL.launch.StartUp - Java version 23.0.1
2025-05-16 10:28:57,754 [3960-main] INFO  VASSAL.launch.StartUp - Java home C:\Program Files\VASSAL-3.7.16\jre
2025-05-16 10:28:57,754 [3960-main] INFO  VASSAL.launch.StartUp - VASSAL version 3.7.16
2025-05-16 10:28:57,754 [3960-main] INFO  VASSAL.launch.Launcher - Player
2025-05-16 10:28:58,871 [3960-AWT-EventQueue-0] INFO  VASSAL.build.GameModule - Freedom: The Underground Railroad version 0.1
2025-05-16 10:29:05,703 [3960-AWT-EventQueue-0] WARN  VASSAL.i18n.BundleHelper - No Translation: Editor.Editor.DeckSendKeyCommand.error_invalid_send_limit
2025-05-16 10:29:05,708 [3960-AWT-EventQueue-0] WARN  VASSAL.tools.ErrorDialog -  Source: {Period1OppositionCards} Error: Send Card to Period 1 Deck[Deck Send Key Command]: Editor.Editor.DeckSendKeyCommand.error_invalid_send_limit  
2025-05-16 10:29:05,713 [3960-AWT-EventQueue-0] WARN  VASSAL.i18n.BundleHelper - No Translation: Send Card to Period 1 Deck

I’m going to disagree with both guys. There’s nothing wrong with storing decks and pieces out of the viewable window area. I’ve done it dozens and dozens of times without ill effect. It’s easy, it works, and acceptable is irrelevant. In your case, I would’ve probably put the main deck out of sight and after dealing the four decks, I would’ve forgotten it. Sometimes I use a special window to store such things, but I have to have a special reason to do it.

Thank you for the details - really helps.

OK,so I think I got a solution

Put in the LimitExpression:

{GetMapProperty("Period1OppositionCards","Main Map")}

Why it needs to be that, I do not know. My guess is that the scope in which the expression is evaluated does not have direct access to the global property Period1OppositionCards, and when we call GetMapProperty we evaluate the property in a specific scope (Main Map) which does have access.

Technically, in Deck.extendedSend, the LimitExpression is evaluated as

 sendLimit = Integer.parseInt(dkc
    .getLimitExpression()
    .getText(this, dkc, "Editor.DeckSendKeyCommand.limit_expression"));

while the TargetDeckName is evaluated as

  targetDeckName = dkc.getDeckExpression()
      .getText(propertySource, dkc, "Editor.DeckSendKeyCommand.deck_expression");

Notice the different first argument to getText: When evaluating LimitExpression that argument is this, while when evaluating TargetDeckName it is propertySource. Perhaps the this should be propertySource.

Also, your report formats are better formatted like

{Period1OppositionCards+" requested; "+sentCount+" moved to "+targetDeck}

Hope that helps.

Yours,
Christian

See this issue and the 2 linked to it; it appears that it may only cause a problem on Player Hand windows, but I would still recommend avoiding it.