Basically, this code shuffles between an array of timers (there are 5) and picks a timer that hasn’t started yet. These timers, upon completion, should disable the conditional button that is linked to it (there are 12 buttons). I want to add that if a timer ends, it disables the corresponding conditional button. If someone could help, this would be greatly appreciated.
ShuffleTimer(SelectedButton:conditional_button_device):void =
if (UnusedTimers.Length > 0):
set UnusedTimers = Shuffle(Timers)
if (NextTimer := UnusedTimers[0]):
NextTimer.Start()
set UnusedTimers = for:
Index -> Timer : UnusedTimers
Index <> 0
do:
Timer
TimeIsDone(Agent:?agent):void={}
I see what you mean but that’s not exactly it, basically in my code, it shuffles between 5 timers and the issue is that I want the running timer to disable the button upon SuccessEvent
You could then listen to the timer’s Sucess event, but then keeping track of which button to disable would be a pain. Do you know the timer will succeed once the button is pressed (in which case waiting for the timer’s duration would work); or could the timer be paused, in which case you are stuck with listening to the success event.