send to "random" location

I’d like to have one counter sent to one hex, chosen randomly from a list of several options.

Right now I when I right click the token I can call a GKC that in turn rolls a “text dice” with several options:
{“hex 0101”, “hex 0101”, “hex 0101”, “hex 2447”, “hex 3880”} (not the same chance for every hex)

The result is written in the log, and the player can then manually move the counter.

I’m curious how would I automate this. Or if there is some module out there with this feature, so I can study and replicate it.

I’d suggest using the random element in a Layer trait, which keeps the whole operation in the counters themselves. I’d put these in their own prototype folder, then add that to the appropriate counters.

You’d have a layer trait named RandomHexLayer and it would be Always Active and have a key command for randomize (I’ll use: goRandom). There’s no menu command for that as a Trigger Action will be used instead. So goRandom chooses a random level… you’d add as many levels as you need… no images in any of them (so the layer and all its levels will be hidden), and put the hex location name as each level’s name… so in your example, levels 1-3 of the layer would each be named: 0101, level 4 would be named 2447, etc.

Now add a Send to Location, with no command name and a key command of goRandomHex. If your module actually uses those hexes as grid locations, then you can send it to ‘grid location on selected map’, choose the map and board, then add: $RandomHexLayer_Name$ to the grid location.

Now add a Trigger Action with command name something like “Send to random location” or whatever, with whatever key command you want, having it watch for that same key. Then add performs: goRandom and goRandomHex in that order [and maybe ReportRandomMove too if you want to add a Report Action noting the move in the message window].

One problem with this method is the counter is now named ($pieceName$, $newPieceName$) after the layer name itself (the hex #). You can use $BasicName$ to report any moves, etc, or you can make the layer not always active, and add commands to turn it on and back off again (before and after the other two actions) in your Trigger Action.

Hope that makes sense, and is actually correct. Any questions or problems with it, just ask.

This sounds promising.

I’ve been able to create a trigger that rolls a text dice (with results like “0120”, “1716”…) and then sends the piece to $dicename_result$. It took me a while to figure but it works.

Problem is, I’d like to rotate or even modify the counter depending on the destination hex. Your approach using layers may be exactly what I need, as I might use a different picture for each layer!

Thanks for your input! Will try and report back with the result.