I want to create a rule like this:
every day, at 10 minutes before sunset
do
However, I want the value 10 for minutes to be a variable that can be a random number between 5 and 25. Is there anyway this can be done?
I want to create a rule like this:
every day, at 10 minutes before sunset
do
However, I want the value 10 for minutes to be a variable that can be a random number between 5 and 25. Is there anyway this can be done?
To output a random integer between 5 and 25 use:
(5 + random(20))
(This does a random number between 0-20, then adds 5)
More info can be found here:
https://wiki.webcore.co/Functions#random
I use random for my “away lighting”…makes it look like someone is shutting the lights of at a different time every night.
Is there a way to take that random number and store it into a variable and then somehow make sure the new random number isn’t the same as the stored one?
I’m trying to use the random syntax mentioned above. First i tried offsetting by -20 minutes and as in the screen shot below and this creates a statement saying: every day, at 20 minutes before sunset
However, when I tried using the random syntax as pictured below, it says every day, at sunset +/- the random number. So not sure what I am doing wrong, the random number should also read every day, at x minutes before sunset
I use the following snippet so I don’t get the same random color for my color rotation. In your case, store the last set of numbers used in lastRandom
variable, then use nextRandom
variable in your offset.
repeat
do
set variable nextRandom = your_expression
until
nextRandom is not lastRandom
end repeat
problem with the last screenshot is that it doesnt know whether that random number is before or after sunset. whereas my first screenshot clearly says before sunset.
Inside the curly brackets it says minus, so it looks right to me. Have you tested it?
You can do a quick test (without waiting for tomorrow) by selecting the expression like in this pic:
Ctrl-X (to cut) … then Ctrl-V (to paste)
You should see the numbers in the grey area change each time.
(Always between -25 and -5)