Using buttons to in/decrease values

Hi and thanks for looking. I would like to revamp my posted Jambo module, and make some much-needed updates. So this is likely the first of a few posts looking to tap into the collective knowledge of the Module Design forum.

I would like to create a more user-friendly gold management system. I would like it to look the attached image. Here’s a low-fi version of how it should look:

(-5) (-1) (#) (+1) (+5)

where (#) is the player’s current gold total. This total would be displayed at all times, and the player could simply click on the +5, +1, -5, or -1 buttons to change his current gold total by those amounts.

Any tips for how to accomplish this?

Here’s the second part of the question: Also, any tips for accomplishing this in a way that will be compatible for linking value to cards? Certain “goods cards” in the game have a Buy Cost, and a Sell Cost. I would like to engineer the module so a player can right-click on a goods card in their hand, and click “Sell Goods” or “Buy Goods” and have the correct amount of gold automatically added/subtracted to their current gold total.

My next question, naturally, is how to do this. I understand how to assgn cards different “buy” and “sell” values. But how can I program the cards to link to a player’s gold supply?

I welcome any and all tips, ideas, or comments. Additionally, please feel free to point me in the direction of an existing module that uses this mechanic, so I can try and copy it.

Thanks all!

Best,

Dalmuti

This is very easy to do.
Create your piece just like you layed out with 4 action buttons each using a different command at the number locations. At the # position put a text label which will display a numeric DP which is also added to the piece. The DP is the workhorse for everything. Depending on the action button pressed, a matching key command should be added to the DP to increase/decrease the specified amount.

Your cards interact by using the piece GKC trait with your property match filter specifying the piece with the buttons / DP. Again what ever the GKC executed from the card is set to must also be added to the DP.

Because you are talking buying / selling good keys to use are number keys so that they match the price of the item (somewhat unless its > 10) making easy to remember what keys are for between components

i.e CTRL 4 for a Card might be to sell the card for $4 so we put on the card a GKC that executes CTRL 4 / CTRL 4 with a pme of BasicName = OtherPieceName and put CTRL 4 on the other piece in the DP which increases/decreases (depending on which way it works) the DP value by 4

From: dalmuti messages@forums.vassalengine.org
To: messages@forums.vassalengine.org
Sent: Fri, February 5, 2010 12:36:39 PM
Subject: [Module Design]Using buttons to in/decrease values

Hi and thanks for looking. I would like to revamp my posted Jambo module, and make some much-needed updates. So this is likely the first of a few posts looking to tap into the collective knowledge of the Module Design forum.

I would like to create a more user-friendly gold management system. I would like it to look the attached image. Here’s a low-fi version of how it should look:

(-5) (-1) (#) (+1) (+5)

where (#) is the player’s current gold total. This total would be displayed at all times, and the player could simply click on the +5, +1, -5, or -1 buttons to change his current gold total by those amounts.

Any tips for how to accomplish this?

Here’s the second part of the question: Also, any tips for accomplishing this in a way that will be compatible for linking value to cards? Certain “goods cards” in the game have a Buy Cost, and a Sell Cost. I would like to engineer the module so a player can right-click on a goods card in their hand, and click “Sell Goods” or “Buy Goods” and have the correct amount of gold automatically added/subtracted to their current gold total.

My next question, naturally, is how to do this. I understand how to assgn cards different “buy” and “sell” values. But how can I program the cards to link to a player’s gold supply?

I welcome any and all tips, ideas, or comments. Additionally, please feel free to point me in the direction of an existing module that uses this mechanic, so I can try and copy it.

Thanks all!

Best,

Dalmuti

Attachments:
vassalengine.org/forums/file … le_210.jpg


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

Post generated using Mail2Forum (mail2forum.com)

Thanks Tim. Can you point me in the direction of a module that makes good use of Action Buttons, I’m not having much luck.

Also, when I’m trying to use a Text Label to display the value of the dynamic property. What do I enter into the “Text” field? I’ve tried "$DPNAME_value$ but it’s not working.

Thanks!

One additional follow-up:

Both players are drawing cards from a shared deck, and discarding into a shared discard.

Each player also has his own gold reserve.

How can I create the situation where the Green Player sells a ware, and it only impacts the Green Player’s gold reserve?

If I set up a DP/GP for GreenPlayerGold and RedPlayerGold, how can I make the cards recognize which player (Red or Green) is playing the card, and in turn, only impact that player’s gold reserve?

Thanks again,

Dalmuti

In the text label you put whatever you named the DP.
So if your DP name is called MoneyInBank you would put $MoneyInBank$ in the text field

From: dalmuti messages@forums.vassalengine.org
To: messages@forums.vassalengine.org
Sent: Fri, February 5, 2010 3:24:47 PM
Subject: [Module Design]Re: Using buttons to in/decrease values

Thanks Tim. Can you point me in the direction of a module that makes good use of Action Buttons, I’m not having much luck.

Also, when I’m trying to use a Text Label to display the value of the dynamic property. What do I enter into the “Text” field? I’ve tried "$DPNAME_value$ but it’s not working.

Thanks!


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

Post generated using Mail2Forum (mail2forum.com)

Now it gets a little more complex.
You’ll need to build a routine using trigger actions. 1 sequence will work for the Green player and 1 will work for the Red. This may also add to the number of keys involved as you dont want keys that affect 1 player affect another’s total

Doing same as before you just add 2 triggers (TA) and another GKC
On the first TA we give it a PME of playerSide = Green player (or whatever the player side is called) which will execute CTRL G, CTRL G will be the key command for that player’s GKC
On the other TA we give the PME of playerSide = Red player, execute CTRL R and CTRL R is the key command for Red player’s GKC

The PME’s in the GKC’s will also have to be modified as you no doubt have 2 pieces showing each player’s Gold reserves so you want to go to the right Gold reserve piece. You can use different names for the pieces or give them a unique Marker trait etc… a way to distinguish one from the other.

So what we have so far for your routine is:

Card

  1. Play a card (Start sequence)
  2. Check (TA) Am I green? yes goto 5 no goto 3
  3. Check (TA) Am I red? yes goto 6 no goto 4
  4. Do nothing
  5. Alter Green Gold reserves (GKC) goto Gold Reseve piece
    6 Alter Red Gold reserves (GKC) goto Red Reserve piece

Gold Reserve Piece (unique name)
Action buttons x 4
Text Label (Show DP Value)
Dynamic Property (4 keys from Action buttons, 1 Key from Card GKC)

Red Reserve Piece
(same as Gold Reserve Piece)

As you can see it is just like building a flow / logic chart of what you are trying to do except it may not be layed out like that inside the editor itself.
Sometimes it helps to layout your logic beforehand like above for instance so you can see how point A is going to get to point B

This is really just a general method, there can be others and keep in mind the keys I give are just plucked out of thin air, you might want to use something else, or have a system you want to follow in how you use keys.
Also Before you start branching your automation though it is best to get it working on one thing first. From there you can start evolving it, see what you need, what will be common to all, what to prototype etc… so you dont double work

From: dalmuti messages@forums.vassalengine.org
To: messages@forums.vassalengine.org
Sent: Fri, February 5, 2010 3:39:33 PM
Subject: [Module Design]Re: Using buttons to in/decrease values

One additional follow-up:

Both players are drawing cards from a shared deck, and discarding into a shared discard.

Each player also has his own gold reserve.

How can I create the situation where the Green Player sells a ware, and it only impacts the Green Player’s gold reserve?

If I set up a DP/GP for GreenPlayerGold and RedPlayerGold, how can I make the cards recognize which player (Red or Green) is playing the card, and in turn, only impact that player’s gold reserve?

Thanks again,

Dalmuti


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

Post generated using Mail2Forum (mail2forum.com)

This is great insight - thanks Tim! I’m going to work on it over the weekend. I’ll report back after I’ve made some progress.

Thanks again for your help,

Dalmuti

I find it much easier to use Global Properties to hold singular things like the Gold Reserve for each player.

Then you can use the ‘Set Global Property’ trait to change the value directly instead of having to use GKC’s to affect the piece that owns the DP.

Rgds,
Brent.

*********** REPLY SEPARATOR ***********

On 5/02/2010 at 2:23 PM dalmuti wrote:


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

Post generated using Mail2Forum (mail2forum.com)

Thanks Brent. If possible, can you please expand on the process to do this? If I make a GP for GreenGold and RedGold, for instance, but the two players are using cards from a shared deck, how can I make the card distinguish which GP to pull from?

The more step-by-step detail you can provide, the better. Thanks so much!

Best,

Dalmuti

Hi Dalmuti,

The most useful property that will be different depending on which player is playing a card will be $playerSide$ which will be either Green or Red.

Your cards will need to do adjust either the GreenGold or RedGold global property depending on the value of $playerSide$.

There are a number of different ways you can approach this, but the simplest would be to use the ‘Set Global Property’ trait and set the Property name that is to be changed to

$playerSide$Gold

This will evaluate when the command is executed to either GreenGold or RedGold, depending on the player currently playing the card.

Similarly if the cost of the card is set in a DP in the card named CardCost, then in the Set property sub-command, the increment value can be $CardCost$. Then you can use the same Set Global Property trait in every card, regardless of cost or player, so it can go into a prototype. All you have to do is set the appropriate CardCost DP in each card.

Other ways to approach this, which might be useful in more complex situations:

  1. Create separate commands for each player and hide one set of them using the ‘Restrict Commands’ trait.

  2. Create seperate commands with no menu option and use ‘Trigger Action’ traits based on $playerSide$ to execute different sets of traits depending on the current player.

Regards,
Brent.

*********** REPLY SEPARATOR ***********

On 5/02/2010 at 10:06 PM dalmuti wrote:


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

Post generated using Mail2Forum (mail2forum.com)