Random Hotkey?

I’m looking for a way to have it when a right click command is given, a random sound is played.

Is it possible to send a random hotkey?

If this requires a Java Class I’m sure I’ll be able to figure it out, I’m just wondering if there is a simple way first.

How many random sounds are we talking about here? You cant do it directly but you could do it indirectly.

When you right click, trigger a silent die roll, then based on the value of that roll, trigger a specific sound i.e on a 1 play sound A, on a 2 sound B and so on, hence it will be random

That’s how I would do it, too. I think the easiest way for a property match expression to get access to a random result is with a Layer trait; so create a Layer trait with a layer for each sound - no graphics, but each should have a name (not necessary, but easier to read) - and run a bunch of Trigger Actions checking _Name = .


only 2 sounds, and thank you I think I can figure it out from there.

Edit: Actually while were at it, how would I get the value of a specific roll? Whats the syntax for that?

The result of the dice roll is stored as a global Property under the name _result, where is the name given to the component. (Example: A dice button is named “2d6” After a roll of 11, the property name $2d6_result$ will resolve to “11” until the next roll.

Scratch that - how have I never noticed the _result property? It would be just as easy, then, to use a Global Hotkey trait to roll a die, then check the result in your Trigger Actions traits - and more straightforward. Thanks, Tim!


I ended up going with the dice roll after the reply, it was a much simpler syntax to work with, thanks for the help Tim and Irish