Hi Josh,Thank you for the quick response. Regarding the termination of experiment, your solution does not work for me, as I did not simply count the duration of a specific state. In fact, as long as mice generated an action, the counter should restart. I succefully used a second timer- global timer2, which can be triggered again by an action, to solve this issue. wrote[quote='Hi Josh,Thank you for the quick response. Regarding the termination of experiment, your solution does not work for me, as I did not simply count the duration of a specific state. In fact, as long as mice generated an action, the counter should restart. I succefully used a second timer- global timer2, which can be triggered again by an action, to solve this issue.' pid='3174' dateline='1622757150']
sma = AddState(sma, 'Name', 'ResetGlobalCounter', ...
'Timer', 0,...
'StateChangeConditions', {'Tup', 'TriggerGlobalTimer1'},...
'OutputActions', {'GlobalCounterReset', 1});
sma = AddState(sma, 'Name', 'TriggerGlobalTimer1', ...
'Timer', 0,...
'StateChangeConditions', {'Tup', 'TriggerGlobalTimer2'},...
'OutputActions', {'GlobalTimerTrig', 1});
sma = AddState(sma, 'Name', 'TriggerGlobalTimer2', ...
'Timer', 0,...
'StateChangeConditions', {'Tup', 'WaitForPoke'},...
'OutputActions', {'GlobalTimerTrig', 2});
sma = AddState(sma, 'Name', 'WaitForPoke', ...
'Timer', 0, ...
'StateChangeConditions', {'GlobalCounter1_End','WaitForLick',BehaviorAction, 'TriggerGlobalTimer2','GlobalTimer1_End','exit','GlobalTimer2_End','exit'}, ...
'OutputActions', {});
Then if ... break was used to step out of the experiment based on whether some following states were skipped.
For the interval issue, I actually don't understand your solution. Can you examplify for me? Remember, this state duration was dependent on mice's response and once mice left the poke, the timer will count from 0 when they poked again.
Thanks very much
Lei