One way to do this is create a
custom event that's triggered when 3 targets are inside a sensor. Write a function that's called every frame, checks to see how many targets are in the sensor, and sends the event. In the viztask function, use the
viztask.waitAny command to wait for either the custom event or 5 seconds:
Code:
waitTargets = viztask.waitEvent(THREE_TARGETS_EVENT)
waitTime = viztask.waitTime(5)
for trial in xrange(numTrials):
d = yield viztask.waitAny( [ waitTargets, waitTime ] )
if d.condition is waitTargets:
print 'targets entered'
else:
print '5 seconds passed'