[messages] [Module General Discussion] Some help with building custom code

capi3101 capi3101a at netscape.net
Wed Sep 4 19:29:30 MST 2013

Alright...so Calculated Properties is how you handle conditional
statements. That's quite good to know.

So, my mod now has a Ratio Calculator piece on the Battle Board. Its
properties are:
1) Basic Piece - simply names the piece

2) Does not Stack - allows normal selection but disallows movement.

3) Text Label - it says "High Side: $highSide$, Ratio: $strRatio$:1,
Maneuver Difference: $manDiff$"

4) Calculated Property - strRatio - which says...
If(GetProperty("Confederation Group Strength")!=0 &&
GetProperty("Kilrathi Group Strength") !=0,If(GetProperty("Confederation
Group Strength")>GetProperty("Kilrathi Group
Strength"),GetProperty("Confederation Group
Strength")/GetProperty("Kilrathi Group Strength"),GetProperty("Kilrathi
Group Strength")/GetProperty("Confederation Group Strength")),NaN)

5) Calculated Property - manDiff - which says...
If(GetProperty("Confederation Group Strength")>GetProperty("Kilrathi
Group Strength"),GetProperty("Confederation Group
Maneuver")-GetProperty("Kilrathi Group Maneuver"),GetProperty("Kilrathi
Group Maneuver")-GetProperty("Confederation Group Maneuver"))

6) Calculated Property - highSide - which says...
If(GetProperty("Confederation Group Strength")>GetProperty("Kilrathi
Group Strength"),"Confederation",If(GetProperty("Confederation Group
Strength")<GetProperty("Kilrathi Group Strength"),"Kilrathi","Sides

strRatio is throwing an error when I open the Battle Board. The
paraphrased message is:
__Bad Data in Module: Expression evaluation error Ratio
Calculator-Calculated Property[strRatio]=(what I typed above), Error=
inline evaluation of: ``_xyzzy=_plugh();'' internal Error: Unimplemented
binary String operator__.

I assume that what's going on is that I'm dividing two integers and
asking for a float. The only other thing I can think of is that it's
ignoring the initial conditional statement and going ahead with
attempting to do the math, despite the fact it's a division by zero.

I'll search the site and see if I can figure out what's going on; anyone
feel free to jump in with the answer, though. This is the last piece of
the mod; I get this figured out and I can go about releasing it.

Read this topic online here:

More information about the messages mailing list