beautypg.com

More information – ETC Unison Mosaic Designer v1.11.0 User Manual

Page 225

background image

Trigger Programming Guide

hour = realtime.hour

if high_tides[(h*5)+3] > hour then

-- not yet reached this entry

return

elseif high_tides[(h*5)+3] == hour then

minute = realtime.minute

if high_tides[(h*5)+4] > minute then

-- not yet reached this entry

return

elseif high_tides[(h*5)+4] == minute then

-- found a match

start_timeline(1)

h = h+1

return

end

end

end

end

end

-- not yet reached this entryController

h = h+1

end

This may look rather dense and scary - but on closer inspection you'll see that it is just a lot of if tests nested
inside each other to check each part of the date and time against the data table. When we detect that the current
time is later than the current entry in the table then we move on to looking at the next entry.

Implementing an interactive game for a Science Museum

In an exhibit children are posed questions and have to select answers from an array of numbered buttons. The but-
tons are large with RGB backlights that are controlled by a Controller to highlight choices and indicate right and
wrong answers. Questions are displayed by a slide projector which is under RS232 control from the Controller.
The buttons are wired to contact closures on the Controller and on RIOs, so that the Controller can check
answers and determine the progress of the game accordingly. The lighting in the rest of the room is designed to
mimic a popular TV quiz show to retain the children's interest, with different timelines for each stage of the game.

I am not going to work through this example - but the key point is that it should now be clear to you that a Con-
troller could be used to implement this sort of advanced interactive exhibit with the use of script. Try breaking
down the problem into discrete parts and you will find that no individual part of this is difficult - although getting it
all to function together reliably would no doubt require a lot of work. The Controller is a viable alternative to cus-
tom software running on a PC and has clear advantages in terms of durability and cost.

More information

In this document we have only covered the basic concepts that are needed to understand or write useful scripts
for the Controllers. For more extensive information on the Lua language there are two documents, both of which
are available online at

http://www.lua.org

or can be bought as books from Amazon.

l

Lua 5.0 Reference Manual

l

Programming in Lua

- 225 -