Error=Method Invocation _interp.count

I’m having more trouble with Error=Method Invocation _interp.count, this time in a trigger.
I’ve tried various expressions, simplifying each time. They all give the same error,
e.g.
Bad Data in Module: Expression evaluation error Expression={Count("{Type==“Banner” && placeGA}",“Main Map”)==2}, Error=Method Invocation _interp.count

Simplifying further, I still get the same error.

  • Bad Data in Module: Expression evaluation error Expression={Count("{Type==“Banner”}",“Main Map”)==2}, Error=Method Invocation _interp.count
  • Bad Data in Module: Expression evaluation error Expression={Count("{placeGA==true}",“Main Map”)==2}, Error=Method Invocation _interp.count

Have I got something wrong that I just can’t see ?

Hi Mark,

Can you please try this on the the 3.6. test build VASSAL-3.6.0-SNAPSHOT-3e3ffbb-13401-Beanshell-audit-trails-windows and see what additional information you get in the errorlog. No need to save the module using 3.6, just load and recreate the error.

Regards,
Brent.

Thanks Brent… tried your suggestion and so far it’s pointed me towards Calculated Properties that normally give a boolean result and are used to set a layer or text trait.

When these CPs are used to set a layer or text trait, problems arise for those pieces in the palette - I suspect because of a change of last year whereby Calculated Properties don’t calculate in the palette. Anyway, the workaround is to make an explicit test for true or false, rather than rely on the CP to be set correctly.

This one has me puzzled. The error is the usual “Unimplemented binary String operator” but the context doesn’t involve a boolean or a boolean operation, to my knowledge. MaxStrength is an integer (Marker trait) and Strength is an integer Dynamic Property; the error occurs immediately as the module loads, at which point Strength will be == MaxStrength. The layer trait is set so zero is Level 1.
There are 8 Prototypes, and numerous pieces, that have this layer trait in the module, but only one error message at startup.

2021-07-03 15:37:22,047 [5799-AWT-EventQueue-0] INFO VASSAL.script.ExpressionInterpreter - Attempting to load /VASSAL/script/init_expression.bsh URI generated=jar:file:/Applications/VASSAL-3.6.0-3e3ffbb-13401-Beanshell-audit-trails.app/Contents/Resources/Java/Vengine.jar!/VASSAL/script/init_expression.bsh
2021-07-03 15:37:22,121 [5799-AWT-EventQueue-0] WARN VASSAL.tools.ErrorDialog - Piece: Trait: Layer - StrengthLayer: Source: {MaxStrength-Strength} Error: Expression evaluation error. See the errorlog for more details.
Expression Audit:
Source type=Piece Trait
Source name=Piece:
Source description=Trait: Layer - StrengthLayer
Source field=Follow expression
Source Expression={MaxStrength-Strength}
MaxStrength=
Strength=
Error=internal Error: Unimplemented binary String operator

Also, the beanshell audit build seems prone to infinite loops with my module at least…

e.g. it is reporting a loop due to referencing the ‘_Level’ property in expression that sets to Layer trait. Seems fair enough, except that I am not referencing that property, but instead this is the expression: {playerSide==Side ? 2 : 1}