Create account / Log in

Dealing cards (sort of)

Talk about module design ideas and techniques.

Moderators: uckelman, Tim M

Dealing cards (sort of)

Postby tbyrne » December 29th, 2007, 6:15 am

OK, I'm looking for suggestions for the following situation.

Lets say I have 1 deck. I need to create buttons to move a specific number of cards to a 2nd empty deck. So there will be several buttons like "Add 5 cards", "Add 12 cards", "Add 20 cards".

Is there a way to do this WITHOUT requiring a player to first shuffle the source deck? I need to be sure that each time someone clicks "Add 5 cards" that 5 random cards get moved from the source deck to the destination deck.
User avatar
tbyrne
 
Posts: 79
Joined: December 10th, 2007, 1:57 pm
Location: Chicago, IL

Postby DrNostromo » December 29th, 2007, 2:09 pm

Seems to me you would just set the deck to Shuffle -> Always.

It's my understanding that when a deck is set this way, any cards drawn from the deck are a random draw ...which is essentially the same as being constantly shuffled.

Does drawing multiple cards behave differently? I've never used such a feature so I may not know what I'm talking about. Certainly wouldn't be the first time. :?
User avatar
DrNostromo
 
Posts: 1072
Joined: December 21st, 2007, 3:54 am
Location: Wine Country, Cal. USA

Dealing cards (sort of)

Postby tbyrne » December 29th, 2007, 2:22 pm

That would work if I wanted to manually draw cards. I want to create a
simple interface which automates the process. This can be done,
creating a piece that when clicked causes a certain number of cards to
move to a specific deck. However, the order is always predictable.

Its a PITA to right click to pick "draw multiple", remeber one of the
specific amounts of cards needed, drag manually to the other deck. I
want my players to have a set of "buttons" that describe the differnt
scenarios that call for specific amounts of cards, so its simple and
hard to screw up (as doing it manually is error prone)

On Dec 29, 2007, at 8:09 AM, "Dr_Nostromo" <messages@forums.vassalengine.org
wrote:

Seems to me you would just set the deck to Shuffle -> Always.

It's my understanding that when a deck is set this way, any cards
drawn from the deck are a random draw ...which is essentially the
same as being constantly shuffled.

Does drawing multiple cards behave differently? I've never used such
a feature so I may not know what I'm talking about. Certainly
wouldn't be the first time. :?

------------------------
&quot;Are they slow moving, Chief?&quot;
&quot;Yeah, they're dead ...they're all messed up&quot;
-- Night of the Living Dead

Dr_Nostromo aka Fritz Goot aka Zett_Riff
Creator - To Be King
http://www.drnostromo.com/hacx/tbk.html







_______________________________________________
Messages mailing list
Messages@forums.vassalengine.org
http://forums.vassalengine.org/mailman/ ... engine.org

_______________________________________________
Messages mailing list
Messages@forums.vassalengine.org
http://forums.vassalengine.org/mailman/ ... engine.org

Post generated using Mail2Forum (http://www.mail2forum.com)
User avatar
tbyrne
 
Posts: 79
Joined: December 10th, 2007, 1:57 pm
Location: Chicago, IL

Dealing cards (sort of)

Postby Tim M » December 29th, 2007, 3:42 pm

Dr Nostromo is on the right track

Set it to auto shuffle
Your buttons should relay a (GKC(Trigger/GKC(Send To Location/Return To
Deck))) Loop - notice the nesting

The 1st GKC (A global one) activates a trigger on a constant piece that is
always present (think 1x1 pixel At start stack that sits on corner of map
and not visible or used)

The trigger relays how many times the 2nd GKC (located on the At start
stack) should fire

The 2nd GKC calls top card of deck to move to a Send to Location such as 0,0
on map

All the cards should have a Proto with unique unused keys that executes the
Return to Deck whenever the Send To Location is acted upon

The movement of the cards in the STL part is so fast you wont actually see
it - its just a method of making the loop work and move the cards 1 at a
time simulating the drawing of the top card

Tim

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: 1823
Joined: December 8th, 2007, 12:22 pm
Location: Earth

Dealing cards (sort of)

Postby tbyrne » December 29th, 2007, 5:23 pm

I won't be in a position to test anything until tonight, but it sounds
like you're saying that STL gets a random card, and RTD does not. So
you have an extra event in the chain to get around that. Is that
correct?

On Dec 29, 2007, at 9:41 AM, "Tim McCaron" <timothy.mccarron@sbcglobal.net
wrote:

[quote]Dr Nostromo is on the right track

Set it to auto shuffle
Your buttons should relay a (GKC(Trigger/GKC(Send To Location/Return
To
Deck))) Loop - notice the nesting

The 1st GKC (A global one) activates a trigger on a constant piece
that is
always present (think 1x1 pixel At start stack that sits on corner
of map
and not visible or used)

The trigger relays how many times the 2nd GKC (located on the At start
stack) should fire

The 2nd GKC calls top card of deck to move to a Send to Location
such as 0,0
on map

All the cards should have a Proto with unique unused keys that
executes the
Return to Deck whenever the Send To Location is acted upon

The movement of the cards in the STL part is so fast you wont
actually see
it - its just a method of making the loop work and move the cards 1
at a
time simulating the drawing of the top card

Tim

Post generated using Mail2Forum (http://www.mail2forum.com)
User avatar
tbyrne
 
Posts: 79
Joined: December 10th, 2007, 1:57 pm
Location: Chicago, IL

Postby tbyrne » December 29th, 2007, 6:26 pm

Actually, I got a chance to test earlier than I thought.

It works for STL or RTD (the randomization I mean). Is this something that got fixed since 2.9 ??? I'm certain I've tried this before with other modules, and ended up with instructions for players to shuffle the deck before do anything automated. I just switched the shuffle to "always" on an older module, and it works. I didn't even try this time because all the times in the past it never worked this way.

I take a different approach to the automation though. I create a dynamic property, and increment it every time I move a card. Then I have a condition on the key for "property name < number to move". So I can just fire the return to decks without any intermediate send-to-location. Tim, I'm sure you have a specific reason for the STL, can you explain why you do it a bit more? I'm always interested in learning other ways to accomplish these types of things.
User avatar
tbyrne
 
Posts: 79
Joined: December 10th, 2007, 1:57 pm
Location: Chicago, IL

Dealing cards (sort of)

Postby Tim M » December 29th, 2007, 7:32 pm

Correct.
This acts just as if you were sitting at a table and needed to draw 5 cards
for poker but don't know what the cards are till they are in your hand as
you draw them 1 at a time

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: 1823
Joined: December 8th, 2007, 12:22 pm
Location: Earth

Dealing cards (sort of)

Postby Tim M » December 29th, 2007, 7:37 pm

There may have been bugs in early 2.9.x builds but I believe it did get
fixed somewhere in there

Nothing wrong with that method either Tim. Thinking about it, there are
probably a number of ways to do this :)

Reason I was using STL was because in a version I use it for I was
transferring the cards between different private/public map windows. Because
the counter piece that triggers the loop can not be in all locations (or
trigger chaos ensues) I place it on the main map and use the main map as the
intermediary w/ STL. The RTD's can then be other window specific depending
on card type/owner or other variables I might want to insert and use etc..

In a fashion this could actually simulate true 'card dealing' ala poker if
used with your DP to count :)

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: 1823
Joined: December 8th, 2007, 12:22 pm
Location: Earth

Dealing cards (sort of)

Postby Brent Easton » December 29th, 2007, 8:02 pm

It works for STL or RTD (the randomization I mean). Is this something
that got fixed since 2.9 ??? I'm certain I've tried this before with
other modules, and ended up with instructions for players to shuffle the
deck before do anything automated. I just switched the shuffle to
"always" on an older module, and it works. I didn't even try this time
because all the times in the past it never worked this way.

Yes, an oversight had meant that decks where only being 'shuffled' when manually drawn from, not when cards where removed by any other means. This was fixed in Version 3.

Regards,
Brent,


____________________________________________________________
Brent Easton
Analyst/Programmer
University of Western Sydney
Email: b.easton@uws.edu.au


_______________________________________________
Messages mailing list
Messages@forums.vassalengine.org
http://forums.vassalengine.org/mailman/ ... engine.org

Post generated using Mail2Forum (http://www.mail2forum.com)
User avatar
Brent Easton
 
Posts: 3255
Joined: December 21st, 2007, 3:06 am
Location: Berry, NSW, Australia


Return to Module Design

Who is online

Users browsing this forum: marcR and 5 guests