I use scenes in my home theater controller to change hardware configurations after each button press. Under normal conditions I trigger a sequence of 7 scenes (Scene0 – Scene6) to reconfigure my home theater hardware, but some conditions only require a few scenes to trigger. I designed a plugin that manages the scene sequence by indexing an array of scene ID’s, and using those ID’s to trigger the appropriate Scene. For example, in order to trigger Scenes 1,2,3 and 6 the plugin initializes an attribute SeqArray = [1,2,3,6] and another attribute SeqArrayIndex = 0. With this array and index combination, the plugin initially assigns a value of 1 to the attribute Scene, as Scene = SeqArray[SeqArrayIndex]. Scene 1 triggers and performs its actions, then tells the plugin to advance to the next scene by setting attribute GetNextScene = 1. The plugin increments attribute SeqArrayIndex += 1, checks the index for out-of-range, and retrieves the next scene if the index is in-range. I have attached both my plugin
SceneSequence.plugin (3.6 KB)
and a demo
Scene Sequencer Demo.hrp (171.8 KB)
to better illustrate this approach.