Easy way to find a hex in a map

I have a very big map with an hex grid + grid numbering.
Sometimes I need to find easily a particular hex knowing its grid numbering.
Looking at the map may take a lot of time, is there a way to find it easily, for instance inserting the hex number in an input box and having Vassal center the map on that hex or using a map flare?

Thanks.

1 Like

Add a Global Property to the module or map. Add a piece with a Set Global Property trait and some way to trigger it; you now have somewhere to type the map coordinates.
Add a Move Camera Button to the map, set the Destination to Grid location on selected Map, and set the Grid Location to $GP$ or {GP}, where GP is the name of the Global Property you added.

Optionally, give the piece you created a Trigger Action that calls the Set Global Property trait and then calls a Global Hotkey trait to trigger the Move Camera button automatically (if you do this, you could choose to hide the button by leaving its text and icon blank).

Thanks for your help but it does not work.
I tried to use the Move Camera Button with fixed parameters but if I set the correct Board Name (for instance “Europe”) and the Grid Location Number (f.i. 1234) I get this error “Bad Data in Module: Source: Main Map Error: Grid location not found”.

If I set “location on selected map” it works.
I tried Grid Location Numbers as string (“1234”), as numbers (1234), with or without {} …

I know that the the number is correct since when I move a counter in the chat I have the message “counter X moves to hex 1234”.

Is there any module that I may look as an example?

Thanks.

I just tried it myself on my Terraforming Mars module, and I can’t get it work, either. This is a relatively new feature (added in VASSAL 3.5 or 3.6, I forget which), so perhaps it wasn’t tested thoroughly? @Cattlesquat, I believe this was your baby, IIRC. Any ideas?

I don’t have any experience with hex grids, but I do see that the Move Camera button runs the same code as the “Send To Location” trait that you can put on a piece.

So my first suggestion would be to get a Send To Location working on a hex map that sends a piece somewhere specific, and then copy those fields into a Move Camera to see if that makes it work?

It does not work with “Send To Location” as well…

1 Like

Okay, that’s what I suspected would probably be the case – so it’s not a problem with Move Camera “per se”, it’s that either (a) none of us know the right way to do a send-to-location to a hex on a map, or (b) there’s a bug in send-to-location to a hex on a map.

This is what’s confusing me, because Terraforming Mars does a bunch of Send-to-Locations to hex grid locations when it starts up!

I grabbed a random module that had a hex grid, and was able to get Move Camera (and Send to Location) to work to a point in that module’s hex grid – see screen shot. An example of hex grid locations that were being displayed in that module is “10.19” and I sent both a camera & a unit successfully to “10.19”

D’oh! Just realized I had the board name wrong in my Move Camera Button test.

Edit: Yep, works fine if I use the correct board name. A bit disappointing that you can’t just leave the board name blank and have it default to the current board, though.

3 Likes

I agree - it’s kind of weird behavior - but it seemed to apply to Send-to-Location too, for whatever weird reason (maybe some games have boards with different hex grids?). I don’t end up down the “Grid location on selected Map” path much myself so not familiar with the ins and outs.

If you’ve got multiple boards, you can probably store the active board in some property and just substitute it in?

Yep, that should work fine. For Send to Location, you can just use {CurrentBoard}, but of course, that doesn’t work with the Move Camera Button, because, not being a piece, it doesn’t have that property.

Okay, just experimented a bit more, and you can definitely use a Global Property to store the destination for the Move Camera Button when configured to move to a grid location; here’s my setup:
image

For testing purposes, I just added a Change Property toolbar button to the Map_location GP.

2 Likes

Yeah I guess you could use a slightly-annoyingly-complex sequence of “Startup Global Key Command” → activates some invisible piece somewhere that’s placed in an At-Start stack → writes its active board into the global property.

I guess some games (e.g. Squad Leader) have multiple boards, each with their own grid of hexes, and so that’s where the distinguishing-by-board stuff came from.

In theory we could enhance that with some “if board is blank, check for map’s first active board and use that” algorithm. Just not sure how fast further-enhancement-work on Vassal 3 is likely to progress these days – the Big Guns are mostly aimed at getting ready for Vassal 4…

2 Likes

Ok managed to make “Move Camera Button” work.
It still doesn’t work if the grid number has leading zeros, like 0123.
It works if the grid number is 2345.

How can I solve it?

Maybe, try enabling this Global Option in your module?

image

It’s a new one developed during v3.6.x and it’s possible you have other parts of your module that depend on the legacy behaviour of dropping the leading zero. I haven’t used it myself yet.

1 Like

Thanks to your help I managed to have a Multi-Action Button to set the Board Name and Grid number in two different GP and a Move Camera Button to move the map to the correct point.

Is there a Way to have a single command for both of them (for instance a single button that first set the two GP and then call the Move Camera Button).

Thanks.

If you want to do the actions one after the other, you can have the button activate a Trigger Action trait which then executes the actions in order. Reference: Trigger Action trait, scroll down to Perform these Key Commands: There are also several examples at the bottom of the page to give you some ideas.

Isn’t the Trigger Action trait associated to a counter?
Is there a way to do it without creating a counter ad hoc since the command is about a map and not counters?

The Trigger Action is a trait of a game piece. However, it is the only way I know to string actions together.
Are either of the buttons a game piece or a trait of a game piece? If so, the trigger action can be added to it.

If you need a menu button to trigger a string of actions, you can add the traits doing the actions and the Trigger Action that will string them together to a piece that will always be on the map. I have used a piece with an image or a text label that displays information I want displayed on the map anyway.

2 Likes