CoRE Example - Lived In Look (Randomly Turn On / Off Lights)


(Alan) #1

CoRE Example - Lived In Look (Randomly Turn On / Off Lights)

This piston example demonstrates the use of a user set local variable, ‘rand’, as well as the use of the systems variable $random. The effect of this core is to give a ‘lived in’ look to your lighting, randomly turning on and off lights for a random period of time. Between each cycle is an additional random wait time of between 1 and 10 minutes.

The piston is timed between the hours of sunset -60 minutes and midnight -60 minutes. As pointed out below, to ‘goose’ the random value each time, use of the ‘Execute during evaluation stage’ is turned on (see below).

The second condition tests to see if the result of the first condition, getting the random number and normalizing it between 1-100, is odd or even. You place your lights you wish to randomize within one of the ‘true’ or ‘false’ results. It’s an added level of randomization and you could even put in Routines here or more Pistons.

For those who may ask why I did not use $randomLevel, I went the route of explaining further setting variables and normalizing them as well.

Piston Mode: Basic

Required:
2 or more lights

Before you begin, turn on Advanced Mode by going into Settings->ExpertFeatures->Expert Mode

When setting the ‘rand’ variable, turn on ‘Execute during evaluation stage’ to goose the evaluation of $random.


CoRE - Variables 101
(Robin) #2

That will only fire once a night?

This is my method, it randomly chooses on or off at a random time in every 30 minute window:

I can adjust the probability of On being chosen over off by tweaking the 1-100 boundary.


(Alan) #3

It’s my understanding that in CoRE(SE) we will have lists/arrays which will make this entire process much simpler.