Non-integers in stack viewer

So, I have a module where I sum up a lot of different statistics in the stack viewer (makes for much easier counting…). But, one of these statistics (naturally the most important one) can have a value of 0.5.

I’ve tried a number of ideas to display this (some time ago), but none of them worked out.

Now, my understanding is that a ‘numeric’ variable in Vassal really only handles integers, so that explains much of the trouble. An easy way of getting out of situations like these is to just store the values, say, doubled, so that 1 is 2, and 0.5 is 1… and then divide it in half when you display it. But of course, you can’t do any math (that I know of) in the Stack Viewer controls. Summing is about all there is.

So, can there be anything added to the Stack Viewer to make some version of this work?

You could have a Calculated Property that generated an appropriate string, e.g.:

“” + yourIntValue / 2 + ((yourIntValue & 1) ? “.5” : “.0”)

Or something like that? (You could add “” instead of “.0” if you want). I put the “” on the end to make sure Beanshell figured out you wanted a string. Possibly it would figure that out without it but I’m not sure.


Oh, heck no. I am not going to try and keep track of ship-equivalent #s in every hex of the board in a module that can have over a thousand (yes!) of counters active. I need to get back to looking at it just for the fleet boxes, but I have enough performance worries there (and sanity concerns).

Only other solution I can think of is to go ahead and display the doubled value, and just clearly label the fact that it is doubled.

Which is why I asked for a bit more flexibility in the stack viewer (dividing, non-integers… etc).