PDA

View Full Version : does viz.go() have an antidote?


vr_boyko
11-08-2004, 12:58 PM
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, 01:31 PM
I substituted the infinite loops with the following snippet:


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, 01: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:
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: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, 01: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:def DisplayMessageAndQuit():
endLabel.message("Thank you for your participation!")
viz.waittime(5)
viz.quit()To trigger the director function simply do the following:viz.director(DisplayMessageAndQuit)