WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Control of timers (https://forum.worldviz.com/showthread.php?t=1613)

vizmaster 08-20-2008 01:23 PM

Control of timers
 
I am using viz.play and viz.pause to control timers. However, I am looking at stopping and starting individual timers. Can I use Timer IDs to control timers?:confused:

farshizzo 08-21-2008 10:57 AM

If you want to control individual timers, then I recommend using the vizact library, specifically, the vizact.ontimer function. Here is some sample code that creates a simple timer and uses the keyboard to toggle it on/off:
Code:

import viz
viz.go()

def DoSomething():
        print viz.getFrameNumber()

#Create timer that calls 'DoSomething' every 1 second
mytimer = vizact.ontimer(1,DoSomething)


def ToggleTimer():
        mytimer.setEnabled(viz.TOGGLE)
       
#Toggle timer on/off when spacebar pressed
vizact.onkeydown(' ',ToggleTimer)


vizmaster 08-21-2008 02:23 PM

Scenario is:
Several test subjects have X amount of time to do something. During that time I need to pause one upto all test subjects. Then resume with whatever time they have left.
Do class timers work independent of each other. Can I play and pause within a class?

vizmaster 08-21-2008 02:30 PM

Does .pauseActions pause between actions in a pool or does it pause the actions. Will it pause a timer in the pool?

farshizzo 08-21-2008 03:42 PM

You cannot play/pause timers within a class timer. .pauseActions will pause the running action. If you have a vizact.waittime action, it will be paused and resumed from where it was paused.

vizmaster 08-22-2008 08:45 AM

Can you answer:
Do class timers work independent of each other. Can I play and pause within a class?

farshizzo 08-22-2008 09:36 AM

No, you cannot. I believe I answered that in my previous post. Sorry if it was not clear.


All times are GMT -7. The time now is 03:06 AM.

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