How to set up Random Text to Speech on events

So what i’d like to do is set up Core to Play a random Text To Speech dependant on an action.

Case example:
Front door opens
wait 5 seconds
Random - 1 of 10 spoken messages is played

I think I can set up the the variables (S1-S10) as global and call them using @S1 but how do I do the randomness in CoRE?


See if you can follow this conversation… almost same as what you’re trying to do.

You could multiply the $random variable by 10 to get a number 0-10

Adding a couple photos to better show what I did. This isn’t an exact solution to your problem but this will get you a randomly generated number from 0-10.

This is the syntax I followed. This will speak a message each time the Front Door is opened so unless this is what you want you may want to add an extra condition(s).

Front Door changes to open

(Using Location)
Wait 5 seconds
Set number variable (Your Variable) = $random * 10

(Using Your Text To Speech Synthesizer)
Switch (Your Variable) Do
Case 0
Speak “Message”
Case 10
Speak "Message"
End Switch