Here is my code:
Code:
import viz
import math
import whrandom
import string
viz.go(viz.PROMPT)
# Get subject number from prompt box
promptMesg = viz.get(viz.INITMESG)
if promptMesg == "":
Subnum = 999
Trial = 100
else:
text = string.split(promptMesg)
Subnum = int(text[0])
Trial = int(text[1])
print "Subnum =", Subnum
print "Trial =", Trial
tex1 = viz.add('3d-room.jpg')
quad = viz.add(viz.TEXQUAD)
quad.texture(tex1)
quad.translate(0,1.1,12)
quad.scale(12.8, 10.24)
def WriteFlag():
# write the flag in the data file
print "Movement Transition Made"
movetime = [.05, .25, .5, 1, 2]
sequences = []
for time in movetime:
MoveRoom = vizact.sequence(vizact.move(0,0,(0.12/time),time), vizact.move(0,0,(-0.12/time),time), int(30/time))
sequences.append(MoveRoom)
sequences.append(vizact.call( WriteFlag ))
MovingRoom = vizact.sequence(sequences, 1)
def WriteFlag2():
#write the flag2 in the data file
print "Participant Noticed Movement"
vizact.onkeydown('n',WriteFlag2)
def timer1():
print 'Elapsed time:',viz.elapsed(), 'seconds'
def onkeydown(key):
if key == ' ':
quad.add(MovingRoom)
vizact.ontimer(60,timer1)
viz.callback(viz.KEYDOWN_EVENT,onkeydown)
So far it hasn't worked. When I run the first iteration the timer lets me know when 60 seconds has passed but the first movement transition doesn't occur until about 80 seconds have passed. And subsequent iterations are not paired with the 60 second timer either. I don't know what i'm doing wrong.