WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 03-31-2009, 09:50 AM
durf durf is offline
Member
 
Join Date: Feb 2009
Posts: 61
stopping a function

Hello,

I have def func1() and def func2() that do not run on timers of there own. I have a def maintask() that controls when each of the def() will start. The problem I am having is once func1() time has expired and func2() timer starts func1() keeps runnning.
Code:
def MainTask():
	
	#Run func1 for 10 seconds
	timer = vizact.ontimer2(0,0,func1)
	yield viztask.waitTime(10)
	timer.remove()
	
	#Run func2 for 10 seconds
	timer = vizact.ontimer2(0,0,func2)
	yield viztask.waitTime(10)
	timer.remove()

	#Quit script
	timer = vizact.ontimer2(0,0,func3)
	yield viztask.waitTime(viz.FOREVER)
	
viztask.schedule( MainTask() )
how do I stop func1() from running once func2() has started?

I can supply more code if need be. Just looking for an example
Reply With Quote
  #2  
Old 03-31-2009, 04:45 PM
masaki masaki is offline
Member
 
Join Date: Jan 2008
Posts: 63
in order to kill a vizact timer, use the following code:
Code:
timer.setEnabled(viz.OFF)
if you want to kill a viztask function use the following code:
Code:
task = viztask.schedule( sometask() )
task.kill()
-masaki
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Walking Function Moh200jo Vizard 2 02-24-2009 10:07 AM
Documentating function names aaThomas Vizard 5 05-15-2007 09:50 AM
Do you know how to send a value for 'pool' to the onActionEnd function? ghazanfar Vizard 1 03-22-2007 10:25 AM
timers and director function Jerry Vizard 1 06-22-2006 09:47 AM
node3d.center function tavaksai Vizard 3 08-13-2004 11:05 AM


All times are GMT -7. The time now is 01:39 PM.


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