Trying to clone instances of a deck with Clone + Send To Loc

I’m working on the X-Wing vassal module and I’d like to do the following:

Solution #1
issue a global key command in order to:
-clone a deck of cards (all 33 of them) from a hidden window (which would act as a “source deck”)
-send the fresh copies to another window with a Send to Location, only 33 should be shipped over, the remaining 33 would stay in the source deck

the problem is that the copies are absolutely identical to the sources, meaning there’s no way to distinguish the older 33 cards and the newer 33 cards

Solution #2:
Have 2 copies of the cards in a “source deck” from the start, non-randomly shuffled, making it a “double sized” source deck of 66 cards

issue a global key command in order to:
-move the first 33 cards from the source deck (easy enough with a global key command)
-issue a command to clone these cards, only if they’re in the source deck window (the moved copies won’t themselves be copied)

the problem is that the new copies will also get the copy commands, triggering an infinite loop.

Do you have an ideas that might help me?

Solution #3: I’m feeling like I’m getting close, but not quite there yet.

as per this earlier thread’s suggestion (the last post) https://forum.vassalengine.org/t/spawning-multiple-instances-of-a-deck/6967/1

I’m creating an At-Start stack in a player hand, filled with generic pieces that might be replaced by one sort of card, or another, depending on the trigger used.
Each card has a replace with other trait pointing to a specific card from the source decks

Once the replacement has been triggered, the source deck is still intact (YES! success!) and the rightful card is in the stack. I just need to also send that replacement to a deck within the same window. How do you transfer stuff from an at-start-stack to a deck?

I can’t use Return to Deck, because that thing demands either I make a choice at design time (I don’t want to) or I let the user select from a (HUGE, HUGE list) at play time, which I also don’t want to.

I really would need to use a return to deck and have it sent to an expression-made location, specifically to window $playerSide$ and into board $playerSide$. What can mimick this using other traits?

Mu0n

I have tried a similar thing but ran into trouble.

See [url]https://forum.vassalengine.org/t/problem-using-clone-and-send-to-location-traits-together/6929/1].

Hopefully you get what you need done. If you have any ideas on my problem (unresolved) please post.

Tim

SUCCESS, it all works now:

A “public” (accessible to players 1 to 8 ) “damage deck dispenser” window that contains:
-1 At-start-stack for each kind of deck I’ll want in the game, each containing pieces in number and variety matching the cards that are present in the game. Each piece in those stacks are completely hidden from view. Their presence act as a “stem cells” if you will. They are not used themselves but will transform into something I want later, using “replace with other”
-A neat property of at-start-stack is that the order of the items is known at module design time and is never random or “shuffled”
-Global Key Commands that appear as buttons in that window, they are used to trigger the spawning

A completely private, hidden from view, unaccessible “Damage Decks” window that contains:
-1 deck for each type of deck that are in the game - they only contain 1 copy for each type of card. For example, say there’s 7 copies of a “Direct Hit!” card, it’ll only have 1 copy of that. These decks act as untouchable source decks.

Then, each player has a private window (viewable to all, but only editable by the owner-player) and contains:
-a few empty deck “trays” for each type of potential decks you might need in a game

When you click on a spawn button in the public damage deck dispenser window, it launches the following events:
-it sends a keyboard shortcut command (CTRL-N) to every counter with a specific property (set to “true”) in the at-start-stack corresponding to the deck you want to be spawned
-the pieces in the at-start-stack receive CTRL-N and it affects them in two ways: 1) A clone trait (also triggered from CTRL-N) in order to make a copy of itself 2) a “replace with other” trait that makes one of the 2 copies of the piece transform into a card; it also sends a new shortcut command to itself, a CTRL-S signal
-The newly transformed piece->card receives the CTRL-S signal and is “sent to location” to map $playerSide$, on board $playerSide$
-The at-start-stack has thus been used to spawn a complete instance of a deck inside your player hand window, while still remaining intact thanks to the cloned copy during this process.
-The source deck in the private window has only acted as a reference, having some of its cards been pointed at with the “Replace with other” trait. None of its cards are ever moved or depleted.
-The spawned cards, if “sent to location” directly at the exact same coordinates of an awaiting empty Deck (in the player window), will be dropped into the deck. If the deck has an auto-shuffling property set, all those cards will be nice, shuffled and ready for play right away.