How to send GKC to 1 piece inside stack of identical pieces

I’ve got a stack of identical pieces, and i need to send a command to only one of them, how might I do that? I know I can do it if they are in a deck, but not sure how to send a GKC to only a single piece in a stack if they are all identical.

I could send them all to a deck, give the command, then send them all back, I suppose, but that seems rather out of the way for something so simple.

So you want the GKC to go to any one of them, but since they’re identical you don’t really care WHICH one?

You are correct the “deck method” is available but I think since that ends up involving TWO successive GKC’s that it would be slower than this:

Thing That Sends The Command:
(1) Zeroes out a global property named “DoneAnyThings”
(2) Sends the Global Key Command “DOtheTHING” (I like some all-caps in my GKC’s so I can tell them from regular internal triggers)

Things That Receive The Command:
(1) Receive “DOtheTHING” in a Trigger Action trait, which only fires on the conditional expression { DoneAnyThings == 0 }
(2) But if DoneAnyThings IS 0 (so we’re the first eligible piece receiving this), then it fires a new internal command “ActuallyDoTheThing”
(3) “ActuallyDoTheThing” causes:
(a) Increments the value of DoneAnyThings by 1
(b) the actual thing you wanted to happen

So that will make sure only one of your pieces acts on the command. Obviously you can easily repurpose that to let you grab “2 things” or some other predetermined number.

By the way, the above assumes that the issuing piece (thing-that-sends-command) is some single piece, and that you don’t need to check for the case of having THAT whole stack currently selected and being right-clicked on, and having every single piece in the stack trying to issue the command at the same time. THAT problem, the “player issues command to every piece in stack, but we only want to do the thing exactly one time not once for every piece in the stack” is a bit more challenging to sort.

Brian

Ah, that is a bit more elegant. I’ll use some variation of that method I think. Thanks!