smiley73 Posted December 4, 2009 Posted December 4, 2009 Hi, I'm trying to write a program which simulates a TV being on, using a dimmer (as part of my vacation programs). This is what I currently have: If - No Conditions - (To add one, press 'Schedule' or 'Condition') Then Repeat 1 times (Random) Wait 3 seconds Wait 3 seconds (Random) Set 'LR LampLinc TV' 50% Repeat 1 times (Random) Wait 3 seconds Wait 3 seconds (Random) Set 'LR LampLinc TV' 75% Repeat 1 times (Random) Wait 3 seconds Wait 3 seconds (Random) Set 'LR LampLinc TV' On Else - No Actions - (To add one, press 'Action') I was hoping that the "Repeat 1 times (Random)" would work to randomly execute certain statements, but that didn't work so well. I guess the 'randomness' is between 1 and the value specified (was hoping it's 0). Is there another way to randomly execute statements? Thanks Heiko Quote
Michel Kohanim Posted December 4, 2009 Posted December 4, 2009 Hi Heiko, Repeating random (in your case) means that it would either repeat the block or not execute at all. I think what you need is to use the Random function on Wait instead of repeat. This way, the amount of time waited for the next statement will be random. With kind regards, Michel Hi, I'm trying to write a program which simulates a TV being on, using a dimmer (as part of my vacation programs). This is what I currently have: If - No Conditions - (To add one, press 'Schedule' or 'Condition') Then Repeat 1 times (Random) Wait 3 seconds Wait 3 seconds (Random) Set 'LR LampLinc TV' 50% Repeat 1 times (Random) Wait 3 seconds Wait 3 seconds (Random) Set 'LR LampLinc TV' 75% Repeat 1 times (Random) Wait 3 seconds Wait 3 seconds (Random) Set 'LR LampLinc TV' On Else - No Actions - (To add one, press 'Action') I was hoping that the "Repeat 1 times (Random)" would work to randomly execute certain statements, but that didn't work so well. I guess the 'randomness' is between 1 and the value specified (was hoping it's 0). Is there another way to randomly execute statements? Thanks Heiko Quote
smiley73 Posted December 4, 2009 Author Posted December 4, 2009 Repeating random (in your case) means that it would either repeat the block or not execute at all. That's exactly what I want, randomly executing the block (or not). Unfortunately it doesn't seem to work, it always executes all the blocks. I think what you need is to use the Random function on Wait instead of repeat. This way, the amount of time waited for the next statement will be random. Using Wait is my backup solution, but this would cause my TV simulation not to be random. It would always go from 50%, to 75%, to 100%. I could probably make the code a bit more extensive, so it looks more random. Heiko Quote
Michel Kohanim Posted December 4, 2009 Posted December 4, 2009 Hi Heiko, I got it ... this seems to be a bug. I have opened a bug to investigate. Thanks SO very much and with kind regards, Michel Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.