View Single Post
  #2  
Old 04-18-2012, 09:57 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Are you using the viztask module to run your trials? Either way, here is some code that shows how you can detect every third trial:
Code:
import viz
import viztask
viz.go()

NUM_TRIALS = 10

def runTrial():

	yield viztask.waitTime(1.0)



def runExperiment():

	for i in range(NUM_TRIALS):

		if i % 3 == 2:
			print 'Special event for every third trial'

		yield runTrial()

		print 'Finished trial',i+1

viztask.schedule( runExperiment() )
Reply With Quote