Create account / Log in

Set Global Property AFTER Key Command

Talk about module design ideas and techniques.

Moderators: uckelman, Tim M

Set Global Property AFTER Key Command

Postby neonpico » June 9th, 2017, 3:38 am

I have pieces that:
A) Set one of their own 'Dynamic Properties'
B) Does a 'Report Action' to publicly state that the value was changed for this particular piece
C) Then does a 'Set Global Property' so that a running total of this dynamic property can be picked up elsewhere

The problem is that the 'Set Global Property' fires in such a way that the previous value of the Dynamic Property is what is posted to the Global Property, not the value after the user has entered a new value.

Example:
Dynamic Property starts at 2
User uses the right-click-menu (or issues keyboard shortcut) to enter a new value, enters the value (say, "4"), and closes the dialog
The global value is incremented by 2
User enters a new value (this time say, 3)
The global value is incremented by 4

So how can I get the 'Set Global Property' to use the new value, rather than the previous value?
Follow-up: Any suggestions on how to increment the global value by the difference of the previous and the new value? (e.g. the change in value)
User avatar
neonpico
 
Posts: 5
Joined: June 9th, 2017, 3:23 am

Re: Set Global Property AFTER Key Command

Postby DrNostromo » June 9th, 2017, 7:19 pm

In the list of traits on the piece, you should have the Set Global Property above the Dynamic Property. Is this correct? If not, you're setting the GP before you've set a new DP.
User avatar
DrNostromo
 
Posts: 1061
Joined: December 21st, 2007, 3:54 am
Location: Wine Country, Cal. USA

Re: Set Global Property AFTER Key Command

Postby neonpico » June 10th, 2017, 1:49 am

That was the problem! Another one of those "The order of the traits tripped me up!" issues...
Thank you much, sir.

***

For future reference, this trick was to perform a public economy reporting. Thus everyone could see the running total of a player's total income, total maintenance, total expenditures, etc... Each running total went through the same process, repeated for each player. So to report 3 different items about a player, in a 4 player game, there would be 12 different processes (all largely the same).

Create a Global Property with a unique 'Name' you can remember and 'Initial Value' set to 0

The marker containing the trait to be counted would have the traits:
Basic Piece - (listed for context)
Set Global Property
  • 'Global Property Name' to the above GP 'Name'
  • 'Key Commands'
    • 'Menu Command' = blank
    • 'Key Command' = *The below DP Key Command*
    • 'Type' = Increment Numeric Value
    • 'Increment By' = {GetProperty("*The below DP Name*")}
Dynamic Property
  • 'Name' to the value referred in the SGP 'Increment By' field
  • 'Key Commands'
    • 'Menu Command' = What you want the right-click menu entry to appear as
    • 'Key Command' = An actual key combo to trigger this command
    • 'Type' = Prompt User
    • 'Prompt' = Some prompt for the user

On some board, create a stack (I used an 'At-Start Stack') with only a single piece. That piece has a 'Does Not Stack' trait and a 'Text Label' trait. The only important field of the Text-Label is it's 'Text' field: "Some Label: $GP Name$"

If this trick is important enough to get outside of this forum-thread, I can create and post screenshots.
User avatar
neonpico
 
Posts: 5
Joined: June 9th, 2017, 3:23 am

Re: Set Global Property AFTER Key Command

Postby neonpico » June 16th, 2017, 6:45 am

Related problem, needs different solution:

Marker in a game piece pallette has these traits in order:
Basic Piece
SGP - 'Increment numeric value' by '{GetProperty("PS property")}' with same key combo as PS
PS - Several properties, set to spinner, with key combo referred to in SGPs
SGP - same as previous SGP except increment value is inverted

There is a single global property that both SGPs refer to.

The "top" (closest to 'Basic Piece') SGP triggers when Prop Sheet is opened. None trigger when Prop Sheet closes. Setting the property value to a smaller number than any previous number has no effect: GP remains at the high-water-mark through many open/close of the PS and different assignments of the property.

This is supposed to decrement the GP by the value of the PS properties when the PS opens, via the "bottom" SGP. Then the "top" SGP increments the GP by the new value of the PS when it closes. This works as expected when using (several) DPs.

Thoughts?
User avatar
neonpico
 
Posts: 5
Joined: June 9th, 2017, 3:23 am

Re: Set Global Property AFTER Key Command

Postby rrvs » June 17th, 2017, 2:08 pm

Someone can correct me if I'm wrong, but I don't believe there's any way to directly tie a change in a Property Sheet trait to a set global property, not without an entirely separate action, even if using a Trigger Action trait to oversee the order instead.

You could have the player record a prop sheet change, then adjust the global(s) on a subsequent hidden action... perhaps a clear moves (end of turn) action, another move of a piece, or a turn counter action, etc.

If the two SGPs are for the same property btw, you can have just one trait with two separate lines. Sorry if I'm misunderstanding that, or any other part of it.
rrvs
 
Posts: 175
Joined: May 20th, 2016, 1:17 pm


Return to Module Design

Who is online

Users browsing this forum: Google [Bot] and 1 guest