So, as the title says whenever im adding more than one timer then it just keeps repeating itself even though i have a
stoptimer("")
or
stopAllTimers()
Here is my code so far
@inputs Thr
@outputs
@persist
@trigger
if(Thr==0) {
timer("BKF1", 100)
}
if(clk("BKF1")) {soundPlay(1,0,"simulated_vehicles/sfx/ex_backfire_1.ogg")
stoptimer("BKF1")
}
This part works but as soon as i do this, it keeps repating itself:
@inputs Thr
@outputs
@persist
@trigger
if(Thr==0) {
timer("BKF1", 100)
timer("BKF2", 150)
}
if(clk("BKF1")) {soundPlay(1,0,"simulated_vehicles/sfx/ex_backfire_1.ogg")
stoptimer("BKF1")
}
if(clk("BKF2")) {soundPlay(1,0,"simulated_vehicles/sfx/ex_backfire_2.ogg")
stoptimer("BKF2")
}
Well, it's simple. When a timer hits 0 it activates the whole e2, which starts the other timer because you probably never wire anything to Thr and it stays as 0. As the stoptimer function is only fired when execution is caused by the timer it stops, it can't stop it's timer. Simply change if(Thr==0) to if (Thr) and you can get rid of stop timer functions, as the timers will stop on their own after one execution. Unless you make a loop again and they will try to start again.
Ahhh... I see. Thank you very much!
Sorry, you need to Log In to post a reply to this thread.