Create account / Log in

A deck question

Talk about module design ideas and techniques.

Moderators: Tim M, uckelman

A deck question

Postby packonn » January 15th, 2009, 5:25 pm

When the game starts, the cards of a deck (25 cards) should be distributed randomly on the main map forming a square of 5x5 cards. Is this possible? Is possible a button with this function? Thanks for advance.
User avatar
packonn
 
Posts: 58
Joined: November 5th, 2008, 4:13 pm
Location: Murcia (Spain)

A deck question

Postby mkiefte » January 15th, 2009, 5:50 pm

What you want is a global key command and make sure "Within a deck apply to" is set to fixed number of pieces. You're going to have to do this 25 times -- one for each position in the 5x5 grid.

And make sure they're shuffled before you do it.

- M.

2009/1/15 packonn <messages@forums.vassalengine.org (messages@forums.vassalengine.org)>
When the game starts, the cards of one deck (25 cards) should be distributed randomly on the main map forming a square of 5x5 cards. Is this possible? Is possible a button with this function? Thanks for advance.




Post generated using Mail2Forum (http://www.mail2forum.com)
User avatar
mkiefte
 
Posts: 1144
Joined: January 5th, 2008, 1:29 am
Location: Halifax, Nova Scotia, Canada

Postby packonn » January 15th, 2009, 6:35 pm

Mmm... too much for me... but I will try. Thanks again, mkiefte
User avatar
packonn
 
Posts: 58
Joined: November 5th, 2008, 4:13 pm
Location: Murcia (Spain)

A deck question

Postby mkiefte » January 15th, 2009, 6:45 pm

It's tricky. I think you're going to have 25 different commands for each card -- one for each position.

And then you're going to need 25 Global Key Commands to pick a card from the deck to go to one of each position.

I can't immediately think of an easier way to do this.

- M.

2009/1/15 packonn <messages@forums.vassalengine.org (messages@forums.vassalengine.org)>
:shock:Mmm... too much for me... but I will try. Thanks again, mkiefte






Post generated using Mail2Forum (http://www.mail2forum.com)
User avatar
mkiefte
 
Posts: 1144
Joined: January 5th, 2008, 1:29 am
Location: Halifax, Nova Scotia, Canada

A deck question

Postby Tim M » January 15th, 2009, 7:13 pm

There is an easier way using a trigger loop using 1 GKC and 1 Send To Location that references a Global property to count.
Essentially give your locations a name that includes a numeric value i.e 1 to 25.
Set the GP to 0
When the trigger starts it increases the GP by 1 with a Set Global property trait, executes a GKC on 1 card only (important) within the deck which tells 1 random card to be sent to the location by using a property match
The trigger then fires off another trigger which checks the value of the GP - if less than desired number, loop back (rinse repeat)

In total you need only about 5/6 traits not 25

I don't have the methodology immediately in front of me right now but it is in the To Be King 0.9.8beta module tiles setup


From: Michael Kiefte <mkiefte@dal.ca>
To: VASSAL Engine Forums Mailing List <messages@forums.vassalengine.org>
Sent: Thursday, January 15, 2009 12:45:08 PM
Subject: Re: [Module Design]Re: A deck question

It's tricky. I think you're going to have 25 different commands for each card -- one for each position.

And then you're going to need 25 Global Key Commands to pick a card from the deck to go to one of each position.

I can't immediately think of an easier way to do this.

- M.

2009/1/15 packonn <messages@forums.vassalengine.org (messages@forums.vassalengine.org)>
:shock:Mmm... too much for me... but I will try. Thanks again, mkiefte






Post generated using Mail2Forum (http://www.mail2forum.com)
Tim,
Vassal Uber Geek/Guru

Problems? post your OS, Physical Mem, version of Vassal and Java plus the Module in question.
No developer can help with out that info, thx!
User avatar
Tim M
 
Posts: 1762
Joined: December 8th, 2007, 12:22 pm
Location: Earth

Postby packonn » January 15th, 2009, 8:06 pm

Thank you Tim. I'm working on it
User avatar
packonn
 
Posts: 58
Joined: November 5th, 2008, 4:13 pm
Location: Murcia (Spain)

Postby DrNostromo » January 16th, 2009, 6:51 am

Here's how I'm doing that in TBK.

Establish a region point (Irregular grid) for each of the 25 points where the cards need to go. Number the region points xx-1 to xx-25 ...or just 1 to 25, if you want but I tend give my region points some sort of letter code.

Establish a Global Property. Something like:

Name: CardSpot
Initial Value: 0
Check "is numeric"
Min value: 0
Max value: 25

Create a prototype called CardSend and give this prototype to all of your cards. The prototype should have the following traits:

Trigger Action
Description: Trigger Send Cards
Trigger when properties match: CardSpot ("is less than" symbol) 25
Keystroke: CTRL 2
Perform these keystrokes: CTRL 3, CTRL 4

Set Global Property
Description: Next Region Point
Global Property Name: CardSpot
check "is numeric"
Min Value: 0
Max Value: 25
Key Command: CTRL 3
Type: Increment Numeric Value
Increment by: 1

Send to Location
Description: Send Card to Board
Keyboard Command: CTRL 4
Destination: Region on Selected Map
Map: (the map with the region points where the cards will be dealt)
Region Name: xx-$CardSpot$

Now that your cards are ready to go, create an At Stack stack near your card layout and place a game piece there to use as a button ...like "Deal Cards"

Give the button the following traits:

Action Button
Description: Send Cards Button
Invoke Key Command: CTRL 1

Global Key Command
Description: Deal Cards
Keyboard Command: CTRL 1
Global Key Command: CTRL 2
Matching Properties: CurrentMap = (the map where your deck is) && DeckName = (the name of the deck)
Within a Deck, apply to: All pieces

Unless I've forgotten something, that should deal all your cards.

Take a look at my development forum for TBK to see the many variations I've done on this.

To Be King Development Forum
User avatar
DrNostromo
 
Posts: 960
Joined: December 21st, 2007, 3:54 am
Location: Wine Country, Cal. USA

Postby packonn » January 16th, 2009, 4:08 pm

Dr. Nostromo, only one (but critical) thing: Where to set a region point?
A few days ago I discovered the incredible Vassal, and I have much to learn!
Thank you very much for your detailed and magistral explanation.
User avatar
packonn
 
Posts: 58
Joined: November 5th, 2008, 4:13 pm
Location: Murcia (Spain)

Postby DrNostromo » January 16th, 2009, 4:33 pm

The tree structure in the editor will look like this for the map you are using for your layout:

Map Window
Map Boards
Board

I'm assuming that you've added a Board at this point.

Right click the Board and select "Add Irregular Grid"

When you look at the Irregular Grid properties, you'll see a button that says "Define Regions". This will allow to your set your region points on the map.
User avatar
DrNostromo
 
Posts: 960
Joined: December 21st, 2007, 3:54 am
Location: Wine Country, Cal. USA

Postby packonn » January 16th, 2009, 7:01 pm

Ok! :D
User avatar
packonn
 
Posts: 58
Joined: November 5th, 2008, 4:13 pm
Location: Murcia (Spain)

Postby packonn » January 17th, 2009, 12:29 am

Hi Dr. Nostromo.
I followed your instructions step by step but does not work. I have some doubts:

1. Establish the Global Property in the “Global Properties” folder of the Module folder? Or in the “Global Properties” folder of the map (the map where I put the cards)?

2. In the Trigger Action trait you write: CardSpot (“is less than” symbol) 25.
Is this Ok?: CardSpot<25

3. In the trait Send to Location, Region Name, you write: xx-$CardSpot$
What is “xx”?

4. I put the deck on the board with At Start Stack?

Thank you for advance
User avatar
packonn
 
Posts: 58
Joined: November 5th, 2008, 4:13 pm
Location: Murcia (Spain)

Postby DrNostromo » January 17th, 2009, 1:58 am

1. Establish the Global Property in the “Global Properties” folder of the Module folder? Or in the “Global Properties” folder of the map (the map where I put the cards)?


The module level should work just fine.

2. In the Trigger Action trait you write: CardSpot (“is less than” symbol) 25.
Is this Ok?: CardSpot<25


Yeah. I just didn't use the symbol in my post as the forum sometimes mistakes the "less than" and "greater than" symbols a HTML tags and it messes up the posting. I put spaces in my property lines but I don't think it makes a difference.

3. In the trait Send to Location, Region Name, you write: xx-$CardSpot$
What is “xx”?


I used xx to represent any lettering code you may have used. For example, if you named your region points CS-1, CS-2, etc., then the line above would read:

CS-$CardSpot$

If you just named your regions 1 to 25, then your line would simply be:

$CardSpot$

4. I put the deck on the board with At Start Stack?


That shouldn't be a problem.

I've attached a sample mod that has a deck and a deal button. Click the deal button and it distributes the 25 cards. I believe this is what you want to do. You should be able to break it down from there.
Attachments
CardDealSample.zip
(6.76 KiB) Downloaded 469 times
User avatar
DrNostromo
 
Posts: 960
Joined: December 21st, 2007, 3:54 am
Location: Wine Country, Cal. USA

Postby packonn » January 17th, 2009, 2:17 am

I have no words... Great Dr.!!!
User avatar
packonn
 
Posts: 58
Joined: November 5th, 2008, 4:13 pm
Location: Murcia (Spain)

Postby packonn » January 17th, 2009, 1:14 pm

Magic!
I hit the button, the deck disappears, and all 25 cards are distributed on the map (5x5).
Exactly what I wanted.

I noticed that this happens only once, at the game start. When the deck is recomposed, the button no work. Why?

Dr_Nostromus: Thank you very very much!!
User avatar
packonn
 
Posts: 58
Joined: November 5th, 2008, 4:13 pm
Location: Murcia (Spain)

Postby DrNostromo » January 17th, 2009, 3:58 pm

The button should work anytime it's clicked as long as there are cards in the deck.

I noticed that this happens only once, at the game start. When the deck is recomposed, the button no work. Why?


How are you recomposing the deck?
User avatar
DrNostromo
 
Posts: 960
Joined: December 21st, 2007, 3:54 am
Location: Wine Country, Cal. USA

Next

Return to Module Design

Who is online

Users browsing this forum: Google [Bot] and 4 guests

cron