Need help setting up a random script

Post your feature requets for new triggers, conditions, actions and other improvements.

Moderator: Martin

Locked
Anthony919nc
Posts: 2
Joined: 25 Nov 2014 16:47

Need help setting up a random script

Post by Anthony919nc » 25 Nov 2014 17:05

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...
Attachments
2014-11-25-12-04-45.png
2014-11-25-12-04-45.png (443.46 KiB) Viewed 10132 times

User avatar
Bushmills
Posts: 286
Joined: 23 Sep 2014 21:56

Re: Need help setting up a random script

Post by Bushmills » 25 Nov 2014 17:55

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?

Anthony919nc
Posts: 2
Joined: 25 Nov 2014 16:47

Re: Need help setting up a random script

Post by Anthony919nc » 25 Nov 2014 20:02

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
2014-11-25-14-59-50.png (334.73 KiB) Viewed 10123 times

User avatar
Bushmills
Posts: 286
Joined: 23 Sep 2014 21:56

Re: Need help setting up a random script

Post by Bushmills » 25 Nov 2014 20:26

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.

Locked