In the Mouse-over Stack Viewer I have a “Summary text above pieces” that reads:
$sum(Steps)$
and shows the total number of Steps in the stack.
But I cannot figure out how to convert it into a beanshell expression so I can perform some operations (I would like to substract another property). For example:
{sum(Steps)}
doesn’t work. I cannot find the answer in the documentation, or what is different about this field (if there is any difference).
Of course if I type:
$sum(Steps)$ - $sum(Detachments)$
I get “8 - 3” and the player must do the math. How could I have “5” instead?
Beanshell expressions are not currently support into the Mouse-over stack viewer. The sum() function is an old hand-coded extension to the viewer and has no relationship to the Beanshell function of the same name.
If “Steps” and “Detachments” are properties of the piece in question, you can add a “Calculated Property” trait to that kind of piece, call it something like “NetSteps”, and set its expression to “Steps - Detachments”. Then you can reference $NetSteps$ in your summary text and it will produce the result you want.