Global key question

I have two counters in a startup stack piece(actually I will have two counters for each player, up to 10 players). To bring new cards into play, one must spend “influence”, so at the start of the turn all influence is unspent (one counter), and the “spent influence” is 0. I’ve been able to create a trigger (spend) that decrements the unspent influence and increments the spent influence counter.

Now there is an action in the game whereby you can create a new influence by rotating another piece, and spending three influence. So I have added a global key in this other piece, that when it rotates, it can cause an influence point to be spent, and can create a new unspent influence. I have attempted to try to get 3 influence spent, by having a trigger spend the influence 3 times (using the same global key), but it appears that the 3 global keys appear to be filtered, so only one global key is sent to stats piece. Is this how global keys work?

I realize I could add another key to the dynamic property to increment/decrement by 3 (and 2, 4, 5, 6, 7, 8, 9, 10). But when I do the math of 2 dynamic properties x 20 functions x 10 players, it would require 400 different key strokes to define the ability to increment/decrement these 20 counters to 20 different values. Is there a way to force a global key to be sent multiple times? I tried making additional triggers, where trigger 1 performs the spend action once, trigger 2 performs the spend action and also triggers action 1, etc for triggers 3-10. But again, it appears that the stats piece only receives 1 triggered “spend” event.

Any help on how this task is done would be appreciated.

On Mar 13, 2009, at 9:00 PM, dcholtx wrote:

OK, I haven’t written any code like this, but…

Perhaps you should add a filtering test, for something like the piece
owner? That would seem to allow you to use the same trigger keystroke
for each player, but have it only affect their own influence counter.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Tar is on the right track - usage of properties is very important. For this problem you should only need 20 keys (the functions).
I have a similar setup with 2 DP’s, 23 specific wpn types and 6 values. Normally this would take 2x23x6 = 276 unique keys but was able to do it with 23.
I had forgotten that I came across this problem before and resolved it till Tar jogged the ol’ noggin
If you need to see how it works you have to look in the Combat Commander module and examine the prototypes “Wpn”, “WpnStatus” , may be a couple other related protos but cannot examine the module right now to see

From: Thomas Russ tar@ISI.EDU
To: VASSAL Engine Forums Mailing List messages@forums.vassalengine.org
Sent: Monday, March 16, 2009 3:08:34 PM
Subject: Re: [Module Design]Global key question

On Mar 13, 2009, at 9:00 PM, dcholtx wrote:

OK, I haven’t written any code like this, but…

Perhaps you should add a filtering test, for something like the piece owner? That would seem to allow you to use the same trigger keystroke for each player, but have it only affect their own influence counter.


Messages mailing list
Messages@forums.vassalengine.org (Messages@forums.vassalengine.org)
http://forums.vassalengine.org/mailman/listinfo/messages_forums.vassalengine.org

Post generated using Mail2Forum (mail2forum.com)

Thanks. I stumble across setting the “piece” owned by each player too. Yes, this works. In addition, I only need 8 triggers: +1,+2,+4,+8,-1,-2,-4, and -8
This lets me get a range of -15 through +15 (for example +3 is +1 and +2). Thought I’d through this use of binary out for others.