WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 12-12-2018, 05:32 AM
Vishav Vishav is offline
Member
 
Join Date: Jun 2017
Posts: 57
But with waitAny task move to next trial after the first mouse click. However, I want the task to remain same for 5s in spite of mouse click.
Reply With Quote
  #2  
Old 12-12-2018, 11:52 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
The following code waits for a signal sent after 5 seconds or a mouse left button press. The code will loop and count the mouse clicks until the signal event occurs:

Code:
import viz
import viztask
import vizact

viz.go()
viz.addChild('dojo.osgb')

s = viztask.Signal()
waitMouse = viztask.waitMouseDown(viz.MOUSEBUTTON_LEFT)
waitSignal = s.wait()

def mouseTask():
	mouseCounter = 0
	vizact.ontimer2(5,0,s.send)	
	while True:
		d = yield viztask.waitAny([waitMouse,waitSignal])
		if d.condition == waitSignal:
			break
		else:
			mouseCounter +=1
	print mouseCounter

viztask.schedule( mouseTask() )
Reply With Quote
  #3  
Old 12-13-2018, 01:18 AM
Vishav Vishav is offline
Member
 
Join Date: Jun 2017
Posts: 57
Thanks a lot
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 07:10 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC