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...
Need help setting up a random script
Moderator: Martin
-
- Posts: 2
- Joined: 25 Nov 2014 16:47
Need help setting up a random script
- Attachments
-
- 2014-11-25-12-04-45.png (443.46 KiB) Viewed 10136 times
Re: Need help setting up a random script
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?
-
- Posts: 2
- Joined: 25 Nov 2014 16:47
Re: Need help setting up a random script
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
- Attachments
-
- 2014-11-25-14-59-50.png (334.73 KiB) Viewed 10127 times
Re: Need help setting up a random script
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.
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.