Jump to content

Random Days


art

Recommended Posts

Posted

I have searched the forum for everyone's version of "away" programs and have incorporate several of my own that I am satisfied with. However, to be the most realistic, I am looking to incorporate a random days function, or at least a good work around. Specifically, somehow use the random function to execute a program only 20% of the time it is called, i.e. if called every day for a week, then execute only once every five days on average , but the number of days (and which days) wiill be completely random within the time period the away condition exists. Right now my programs run every day a half an hour after sunset if the away condition is true and this works fine.

Posted
... Specifically, somehow use the random function to execute a program only 20% of the time it is called, i.e. if called every day for a week, then execute only once every five days ...

 

Some variation of the following would work. You basically have RSTOP trying to stop RSTART before it can call Do Something. You can adjust the wait in each program to change the frequency at which Do Something actually gets called.

 

RSTART

Then
       Wait  10 seconds (Random)
       Run Program 'Do Something' (If)

 

RSTOP

 
If
       Program 'RSTART' is True

Then
       Wait  4 seconds
       Stop program 'RSTART'

 

 

You could also do something similar in one program:

If
       From    Sunset  + 30 minutes
       For      4 seconds

Then
       Wait  10 seconds (Random)
       Run Program 'Do Something' (If)

Else
  - No Actions - (To add one, press 'Action')

Posted

RSTART and RSTOP; INGENIOUS ! ! :D Thank you.

 

As for the all in one, I didn't think the IF would be re-evaluated at the end of the time span, i.e. in 4 seconds; but that that's why I'm here typing.

 

Thank you!

Guest
This topic is now closed to further replies.

  • Recently Browsing

    • No registered users viewing this page.
  • Who's Online (See full list)

    • There are no registered users currently online
  • Forum Statistics

    • Total Topics
      37k
    • Total Posts
      371.4k
×
×
  • Create New...