View Single Post
  #18  
Old 11-28-2007, 01:09 PM
Elittdogg Elittdogg is offline
Member
 
Join Date: Aug 2007
Posts: 77
This is the code I have: (Oh and by the way...I don't know how to make it into the [code]/[code] thing...to make it come out like it shows up in Vizard).

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 = [0.05, 0.25, 0.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 ) )
sequences.append( vizact.call( WriteFlag3) )

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)


And the computer's frame rate is 60Hz.

So with the object that I'm using I can't use the viz.tick; I get this error message:
Traceback (most recent call last):
File "<string>", line 12, in ?
File "MOVING ROOM (FINAL).py", line 51, in ?
startTime = viz.tick()
AttributeError: 'module' object has no attribute 'tick'

Anyway, I ran it again, but it still doesn't come out to every minute. I don't know. Maybe I'm doing something wrong elsewhere in the code?
Reply With Quote