beautypg.com

ETC Unison Mosaic Designer v1.11.0 User Manual

Page 220

background image

Unison Mosaic Designer User Manual

N = realtime.weekday -- 0 is Sunday, 1 is Monday,...

-- we want Sunday to be 7 rather than 0

if N == 0 then

N = 7

end

start_timeline(1)

The timeline would be set to loop when it was programmed. We also put a flag on the timeline at the end and
make a flag trigger that runs a second script:

-- decrement N

N = N - 1

if N == 0 then

-- release timeline 1 in time 5s

stop_timeline(1,5)

end

Note how this works by setting the value of the variable N in one script and then using that variable in another
script, which is often a useful technique.

I have used two scripts here, but it is possible to do the same job using only one - can you see how?

In this case you would have the sunset trigger start the timeline directly and use the following script on the flag
trigger:

-- is this the first time round?

if not N or N == 0 then

N = realtime.weekday -- 0 is Sunday, 1 is Monday,...

-- we want Sunday to be 7 rather than 0

if N == 0 then

N = 7

end

end

-- decrement N

N = N - 1

if N == 0 then

inject_trigger(2) -- runs action on trigger 2

end

The trick here is to detect whether it is the first time round the loop - if the Controller has started up today then N
will have no value and so not N will be true, otherwise N will have been left with the value zero when the script
ran yesterday. When we detect it is the first time then we set its initial value in the same way as before.

I have also used a different method to do the timeline release. Rather than calling stop_timeline directly from
the script I am causing trigger number 2 to fire. We can then configure trigger number 2 to have an action that
releases the correct timeline. It is sometimes easier to write scripts like this when they are going to be sent out to
a customer who does not know how to modify them. In this case all the customer needs to know is to modify the

- 220 -