合并前,多个时钟单独创建事件:
winform.setInterval(
2000,function(){
io.print("输出变量:","abc");
}
)
winform.setInterval(
5000,function(){
io.print("输出变量:","123");
}
)
winform.setInterval(
9000,function(){
io.print("输出变量:","cba");
}
)
合并后,只需一个时钟即可:
//定义时钟周期数组
var timers = {
{2,"abc"};
{5,"123"};
{9,"cba"};
}
//定义一个计时变量
..timerStart = 0;
//定义时钟事件
winform.setInterval(
1000,function(){
..timerStart++;
for(i=1;#timers;1){
if !(..timerStart%timers[i][1]) io.print("输出变量:",timers[i][2])
}
}
)