[messages] [Module Design] Calculated Property - Timing of Calculation and ???s
pfell.688 at gmail.com
Sun Aug 11 09:00:38 MST 2013
I've gone back to a couple of modules that are pre-3.2 and I'm updating
some of the trait sets. However, there are a couple of concepts about
Calculated Properties that I don't understand yet.
1) When does the calculation occur? I've been trying to work out where
to place the CP traits amongst the other ones already present, as I need
some of the calculations to occur before various triggers and reports
are generated. Two cases:
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?
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?
2) If the new Expressions are based on BeanShell, is there a way to have
the Alert box text accept a CR? I have a few messages that need to pop
up in the middle of a series of traits, but the text is a bit long, so a
carriage return would help immensely with formatting. However, "/n"
doesn't seem to achieve this. Is there an escape code or some other
"slash code" that I need to use?
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?
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?
Thanks to everyone for the work on 3.2. I'm finding all sorts of new
ways to enhance my modules. 8)
Read this topic online here:
More information about the messages