lueck Posted June 19, 2011 Share Posted June 19, 2011 This is probably very simple, but I can't figure it out. I'm trying to get a sound if any of about 70 inputs proves true. I'm using : if ((input_timer1[0]) > 10) system.sound.Play("c:\windows\media\notify.wav") endif This works fine for one channel, but I don't want to have to add it 70 times. Is there a way to use a range of channels or a group of channels? Link to comment Share on other sites More sharing options...
AzeoTech Posted June 20, 2011 Share Posted June 20, 2011 Not from the channel event, since these are unique for each channel, but if this script was running in a Sequence loop, then definitely. There are two choices depending on your channel names. If your channel names are simply input_timer1, input_timer2, etc. then you can do this: for (private i = 1, i < 71, i++) if (evaluate("input_timer" + i + "[0]") > 10) system.sound.play("....") endif endfor If the names are sequential like that, I'd put all the desired channels in the same channel group, then get a list of them by doing: private string list = channel.listAll("groupName") where groupName is the name you gave to that group of channels. Then you can do almost the same thing: private string list = channel.listAll("groupName") for (private i = 0, i < numrows(list), i++) if (evaluate(list[i] + "[0]") > 10) system.sound.play("....") endif endfor Link to comment Share on other sites More sharing options...
lueck Posted June 20, 2011 Author Share Posted June 20, 2011 Thank you. I do have it a sequence and this will really help. Mike Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.