Make a timeline loop n times – ETC Unison Mosaic Designer v1.11.0 User Manual
Page 219

Trigger Programming Guide
index = 1
end
-- start the timeline whose number is at entry 'index'
start_timeline(timeline[index])
-- increment index
index = index + 1
-- should we go back to the beginning of the table?
if index > n_timeline then
index = 1
end
How would this change if we wanted each button press to choose a timeline at random rather than cycling
through them in order?
-- which timelines should we cycle through?
timeline = { 22, 14, 24, 16, 15, 17, 21 }
n_timeline = 7
-- use the random function to set index
index = math.random(1,n_timeline)
-- start the timeline whose number is at entry 'index'
start_timeline(timeline[index])
Of course if the timeline selection is truly random then it will sometimes select the same timeline twice in a row. If
we wanted to prevent this from happening how could we do it?
-- which timelines should we cycle through?
timeline = { 22, 14, 24, 16, 15, 17, 21 }
n_timeline = 7
-- find an index different from the old one
while index == oldIndex do
-- use the random function to set index
index = math.random(1,n_timeline)
end
-- store the index for next time round
oldIndex = index
-- start the timeline whose number is at entry 'index'
start_timeline(timeline[index])
Make a timeline loop N times
The designer has requested that a particular timeline runs once at sunset on a Monday, but twice at sunset on a
Tuesday, three times at sunset on Wednesday, etc. He is planning to keep changing the timeline so does not
want to have lots of copies.
There are actually lots of perfectly reasonable ways to solve this using script. Let's assume we have a single
astronomical clock trigger that fires at sunset and runs the following script:
- 219 -