Page 1 of 1

Need help setting up a random script

Posted: 25 Nov 2014 17:05
by Anthony919nc
I want to set up a script like this...
Want to generator random number 1 through 10 and depending on the random number I wanted to trigger an action very new to this anyone can help...

Re: Need help setting up a random script

Posted: 25 Nov 2014 17:55
by Bushmills
You better tell what "depending on the number..." means, and what part of your exercise you have problems with. Testing the condition? Associating an action with the outcome?

Re: Need help setting up a random script

Posted: 25 Nov 2014 20:02
by Anthony919nc
What code do I use to trigger if the number is 5 so it run this app or if the number is 4 so it can run a different app... I was using sound to test it but I'm bit confused thank you

Re: Need help setting up a random script

Posted: 25 Nov 2014 20:26
by Bushmills
More than one way exists to solve that.
I'd possibly create a flow for each random number I want to associate an action with, keep them all in their own group, and give them names according a chosen pattern, like random_execution_5. Then your action to dispatch to the corresponding flow would be "Execute flow", with flow name specified as "random_execution_{nameofyourvariablewithrandomnumber}".

But if all those actions are playing sounds, just with names different, create a list with their names as elements, and select a random element from that list, then play that sound.