Problem with Send To Location

Hello!

I am using the Send To Location trait to move units to a given hex chosen via the global property DestinationHex . All works fine if the destination hex is “1000” or higher, but any attempt to send units to a hex starting with a zero will fail. DestinationHex is not a numeric variable, but even entering a value such as “0908” from the prompt, the stored value is always 908 and when using Send To Location to $DestinationHex$ , is reported the error : “Grid Location Not Found”.

What am I doing wrong?

Panther_2010

Try {"$DestinationHex$"} in place of $DestinationHex$ for the Send to Location. If that still doesn’t work, try {DestinationHex < 1000 ? "0" + DestinationHex : DestinationHex}.

Unfortunately, VASSAL is a bit too agressive about treating anything that looks like it could be an integer as an integer (and therefore, dropping leading zeros). The first version tells it to treat DestinationHex as a string, which will be fine if it hasn’t already lost the leading zero; the alternate version should add the leading zero back if it’s already missing. I haven’t tested either, so no promises!

Edit: Forgot the $-signs around the first example.

Another workaround that I’ve used is to devise a grid scheme based on an alpha for the first part.

Well, I gave up! There is no way to force Send To Location to accept a value like 0705. Vassal always drops the leading zero and treats the property as numeric even if defined differently. Any attempt to add the leading zero, using different techniques and syntax has failed miserably. Hope this issue will be is fixed in the future. In the meantime, I still managed to get around (not fix!) the problem using a Move Fixed Distance trait instead of a Send To Location trait, obtaining just the same result.

Panther_2010 :unamused: