[messages] [Module Design] Calculated Property - Timing of Calculation and ???s

Brent Easton b.easton at exemail.com.au
Sun Aug 18 23:29:49 MST 2013


> 1) When does the calculation occur?


Whenever a reference to it in another trait or component is evaluated. 


> 1a) If the CP is called "Total" and the expression is "A+B", then when
> are A and B summed? Are A and B summed when that trait is reached in
> the list of traits, or is it summed when "Total" is called the first
> time? Or is it neither?


Each and every time a trait referencing Total is evaluated.


> 1b) If the CP is called "Total" and the expression is (pseudo-code)
> "If DeckName==DiscardPile || CurrentZone==AllocatedZone, Cards = Cards
> + 1, Cards", when is "Cards" calculated?


I do not understand the 'Cards = Cards + 1, Cards' part. A CP can never
change the value of a property, it only returns a value. It is
recalculated each time it is needed.


> is there a way to have the Alert box text accept a CR? 


Not sure about that one, will look into it.


> 3) Does "SumStack" work in an analogous way to the commands that allow
> you to calculate the number of cards remaining in a deck, or am I
> misunderstanding its usage?


It could be used this way if the property you where summing had the
value of '1' in each unit in the stack.


> 4) If the "Compare" command for properties allows you to compare
> objects, can it accept "null" as a parameter? I tried to use this to
> test whether or not something had been set by another trait, but a
> null value just generated an error. How do you use this?


Use the empty string "" to compare to something that has not been set.
Everything in Vassal is strings.

_______________________________________________
Read this topic online here:
http://www.vassalengine.org/forum/viewtopic.php?p=41701#p41701


More information about the messages mailing list