Hi Panter2010
To A)
DP can also increment by another given property, not only by a fixed value. The only problem is that you have to take care how you expression looks like. If you simply type
- Code: Select all
$Prop$
Vassall will handle this as a string, so it will not use the actual property value. You have tu sorround it with curly braces:
- Code: Select all
{$Prop$}
This will be done automatically if you use the expression generator by clicking on the calculator icon. But sometimes I quickly wanted to enter an expression and I often forgot the curly braces which won't work. So maybe this is also the case for you?
Your example of a CP with
Name: Prop1
Expression: Prop1 + Prop2
won't work, because it will create an infinite loop while evaluating the expression of Prop1. Prop1 will be recalculated whenever the properties of its expression changes. Since Prop1 itself is part of its own expression this is always the case.
So you don't need a CP for this case. In principal a DP and a CP are very similar. The only difference is that a DP can only change on a Trigger, so either a click by the user on a menu, or some other key command from somewhere else. A CP is always recalculated. As Brent Easton already said, its behaviour is very similar to a spread sheet cell with a formular.
To B)
The If-Then-Else syntax is as follows:
- Code: Select all
If(<expression>,<then-case>,<else-case>)
Where the names in <> are actual expressions. So in your case this would look like this:
- Code: Select all
Name:Prop2
Expression: { If($Prop1$ == true, X, Y) }
You have to use == instead of = for an equality check and again the curly braces are needed. What I am not sure about is how Vassal actually handles boolean values. It works in this example but to on the safe side I always use string comparison.
I attached a dummy module which uses all the mechanics I described above, if you want to have a look at it.