Hi, I am trying to create a simple Piece Inventory Window which counts the number of cards each player has in their hand, but I cannot figure out how to apply the CountMap() or SumMap() functions.
I am using the Window below to count the number of cards which have a “SupporterCount” marker with a value of 1. But when I look at the display, the function does not return a value, it only shows the function itself. I guess this is a syntax problem, but I cannot figure it out for the life of me.
You’re trying to use a Beanshell function in a legacy format in the “Label for folders” field. Though it lacks a “calculator button”, I’m pretty sure that it will accept Beanshell. Try this instead: {"$PropertyValue$ = " + CountMap("SupporterCount")}
Alternatively, I think this will work too: $PropertyValue$ = sum_SupporterCount
The sum_ prefix is a legacy feature that counts up pieces for which the named property defined.
You might also simplify your match field by replacing the CurrentMap == "..." bits with: CurrentMap.endsWith("Hand")