Scripted Lights Controller

I would love to have a script that allows cycling through material ID. I am trying to animate a casino-like light board made of tens of light bulbs/leds. I thought the easiest way to do it would be creating an array of bulbs arranged by material ID and then design a pattern in multi subobject meterial so I could somehow scrub through it and achieve animation effect. The material modifier allows to change ID for the whole object only and MaterialByElement shuffle ID`s in a random manner. This could also work with a raw of lights by turning them on and off in repetable pattern. If anyone can help I will be gratefull :)
Here is an example: