Shifting several pieces along a track..

New to Vassal and having some issues with Global Key Command and Send to Location…

I’m trying to have a Global Key Command button… lets call it Shift, that shifts some pieces along a grid, based on an Offset. The pieces are in Zones named numerically.

So, for example, if there are three pieces A, B, and C, in zones 1, 2, and 3 respectively, the Offset determines where each piece moves. If the Offset is 1, piece A moves from zone 1 to 2, B from 2 to 3, and C from 3 to 1. If the Offset is 2, piece A moves from zone 1 to 3, B from 2 to 1, and C from 3 to 2.

I feel like I’ve tried everything and it just won’t work properly! Sometimes pieces move farther than they were supposed to. Sometimes the pieces stack. I tried implementing a “Moved” property that stopped pieces from repeating moves, but I’ve had difficulty reseting that property after every piece has shifted…

Not sure if I’m overthinking or what, but I could really use some guidance. Test module attached.

I have downloaded and I am having a look.

I figured it out!!

Will post solution later.

Okay I am not sure I can provide an answer yet, but I have some observations.

1.) I am not clear why you are using a multizoned grid. It looks like massive overkill. I believe you would do better with a rectangular grid. You probably want to set “snap to grid” and then I believe it will behave like you are trying to do with a multi-zoned grid. I think you can name the grid regions and then you can make the destination “region on selected map”. (I usually end up using irregular grids myself.)

2.) The way you are using Send To Location looks okay in principle to me (subject to the above comment).

3.) I notice that your Piece prototype does not have a “Do Not Stack” trait. That will probably be the reason for the stacking. In my modules (not heavy wargames!!) the vast majority of my pieces have some use of the Do Not Stack trait.

4.) I don’t feel like I have got to the bottom of your question. That would require me to spend some time getting my head around what the module does, is and your quite brief description. By the time I do you may have made some progress.

Okay I think you would need to give a very specific list of steps, what you expect to see at each step and what actually happens, That’s it for now.

Without looking at the module, I guess you are falling foul of the order of operations. For example, once a piece moves from 1 to 2, it becomes a valid target for the next trigger, which moves it again.

At some point in every sequence there is a loop, where this kind of thing happens. You need to identify the looping point, and create a gate in the sequence - a trigger that prevents a second move. There are lots of ways to do this: dynamic properties, moving a piece to an off map destination then moving back where it is intended to go, etc.