WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   does viz.go() have an antidote? (https://forum.worldviz.com/showthread.php?t=244)

vr_boyko 11-08-2004 11:58 AM

does viz.go() have an antidote?
 
I am looking for a command: maybe viz.stop()
that simply kills all timers, and "freezes" keyboard/mouse inputs but does not kill the head tracking...
right now, I am using an infinite loop, which is by far the least elegant of ways... but it stops the user once thir time is up.

Also, is there a way to put a "console" message (something like "Thank you for your participation") in the user's view after their time is up (and the above STOP command has been issued)

Thanks!

vr_boyko 11-08-2004 12:31 PM

viz.waittime is not much better than an infinite loop
 
I substituted the infinite loops with the following snippet:

Code:

endLabel.message("Thank you for your participation!")viz.waittime(5)
viz.quit()

However, this does not have the desired effect of displaying a thank-you message for 5 seconds before quitting, instead, it idels for 5 secods, flashes the thank-you message for a split-second, and quits ....

I have had trouble with viz.waititme on other occasions.
Can you please explain the correct way to use it or suggest alternative solutions to my problem (see previous post)

Thanks again.

farshizzo 11-08-2004 12:33 PM

Hi,

The command viz.pause will freeze all current timers, which can later be resumed with viz.play(). This doesn't stop keyboard and mouse events though. An alternative might look something like this:
Code:

def StopEvents():
        viz.callback(viz.KEYBOARD_EVENT,0)
        viz.callback(viz.TIMER_EVENT,0)
        viz.callback(viz.MOUSEDOWN_EVENT,0)

def ResumeEvents():
        viz.callback(viz.KEYBOARD_EVENT,onkeydown)
        viz.callback(viz.TIMER_EVENT,ontimer)
        viz.callback(viz.MOUSEDOWN_EVENT,onmousedown)

You can then use these functions to freeze/resume input.

To display text to the user you can create a text object like so:
Code:

text = viz.add(viz.TEXT3D,'Thank you for your participation',viz.SCREEN)
#Place in the middle of the screen
text.translate(0.5,0.5)
#Set alignment to center of message
text.alignment(viz.TEXT_CENTER_CENTER)
#Initially hide the text
text.visible(0)

When you want to display the message to the user simply make the text visible.

farshizzo 11-08-2004 12:38 PM

Hi,

viz.waittime should only be used with director functions. If you use the command outside a director function then it affectly freezes the graphics engine for 5 seconds. The following code shows how to accomplish this with director functions:
Code:

def DisplayMessageAndQuit():
        endLabel.message("Thank you for your participation!")
        viz.waittime(5)
        viz.quit()

To trigger the director function simply do the following:
Code:

viz.director(DisplayMessageAndQuit)


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

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