I am just playing around with module design. I have some questions that I hope to find help with. Hopefully somebody will be able to help me either with an small example mod or explaining what I should do.
I have 3 stacks of cards labelled Stack A, Stack B and Stack C. I can take the top card of any stack and add to the board. However, I can also replace cards from the board and back to the appropriate stack. How can I prevent cards from being returned to the wrong stacks? (i.e. a card belonging to stack A being placed in Stack C by accident)
I want to create a solitaire game that has a deck of 100 cards. At the beginning of the game I want to randomly set up four columns of 10 cards (going downwards and overlapping each other slightly, so you can see each card in the stack) and a separate stock pile. How can I do this?
The stacks example is great, but how can I get each individual card to overlap, so each of the 4 stacks are vertically aligned and overlapping one another (so you can see the card underneath the previous one? each stack should look like this:
Here’s a sample that does that. This one is going to require some explanation.
In the previous example, I used empty decks and the RTD trait to send cards to those decks. For the display you want, that won’t work.
I removed the empty decks and placed Region Points on the map (look under Main Map [Map Window] - [Map Boards] - Main Board [Board] - [Irregular Grid]). These represent the points the cards will be sent to.
There’s a quirk in the Vassal editor that I need to point out or you’ll probably never find out how I made the cards cascade. If you go into the properties of [Game Piece Prototype Definitions] - Card Common [Definition], you’ll notice the Send to Location traits used to send the cards to the region point. Near the bottom you’ll see an unchecked box called Advance Options. If you check this box, the offset options will appear. So, keep in mind that if you use offset options and save the trait, the next time you open it, the Advanced Options box will not be checked but the offset commands are still there and operational.
You’ll note that I have the cards set to offset by 20y times $CardCount$. The CardCount is a Global Property that I included. This keeps track of where to place the card. For example, if the CardCount = 5, the card will move to the Region Point and then drop 20y * 5 or 100y
If you look at the Main Map properties, you’ll note that I’ve set the map to fire a CTRL 0 (zero) to a piece that is moved to this map. The CardCommon Prototype has 2 Trigger Action traits that are set to fire on a CTRL 0. One is set to fire if the CardCount < 10 and one is set to fire if the CardCount = 10. This sends a command to a Set Global Property trait that will either increase the CardCount by 1 or reset it back to 1.
Thanks for the example, it has helped a great deal.
I also created a discard space for card discards. When a player right clicks on a card (from any of the 4 stacks) he can select ‘Discard’ from the menu to send a card to the discard space. Now, in a similar vein, is there any way to position the cards so that any time a player sends a card to the discard space, they are ‘ribbon spread’ in the discard stack (going across, instead of down)?
Here is a basic example of what the layout would look like (ignore the values of the cards, they will all be different). The discard space could also be much longer:
Create a Global Property called
Initial value = 0
Range = 0 to 100 (assuming there’s a total of 100 cards)
Create a Region Point on the map which will be the center point of the first card that’s discarded. Let’s call it DiscardPile
In the card prototype, add the following traits (Note that a list of traits is executed from the bottom up so you would list them in the prototype in reverse order than shown here)
Menu Command = Discard
Keystroke = ALT E (or whatever you like)
Perform these keystrokes
Send to Location
Keyboard Command = ALT F
Destination = Region on Selected Map
Map = Main Map (or use the Select button to select the map where you placed the DiscardPile Region Point)
Region Name = DiscardPile
X offset = 20
times = $DiscardCount$
Set Global Property
Global Property Name = DiscardCount
Range = 0 to 100 (or same as DiscardCount Global Property)
Key Command section
Menu Command = (blank)
Key Command = ALT G
Type = Increment numeric value
New Value = 1
When you right-click a card and select Discard, this process will send the card to the DiscardPile Region Point and increase the DiscardCount by 1. This will cause the next card, and each subsequent card, to move 20x to the right of the last card.