View Single Post
  #5  
Old 11-14-2013, 04:18 AM
Frank Verberne Frank Verberne is offline
Member
 
Join Date: Mar 2008
Location: Netherlands
Posts: 148
Hi Saajaja,

Seems like you already figured out how to solve your problem. However, a simpler solution seems like to yield a function, where you do something with the input. Everything that is in that function should be executed before showing the world again. Now, I just print the input and wait a few seconds, so you can see that everything in the function is executed before executing the rest of the code.
Code:
import viz
import vizinput
import vizact
import viztask

piazza = viz.add('piazza.osgb')
viz.go()

def printValue(value):
	print value
	viz.waitTime(4)
	
def getInput():
	# Blindfold.
	viz.MainScene.visible(0,viz.WORLD)
	viz.clearcolor(viz.SKYBLUE)
	yield viztask.waitFrame(1)
	
	# Ask for input
	input = ''
	while input == '':
		input = vizinput.input('Input something.')
	
	yield printValue(input)
	# Unblindfold.
	viz.MainScene.visible(1,viz.WORLD)
	viz.clearcolor(viz.BLACK)
	yield viztask.waitFrame(1)

def inputScreen():
	viztask.schedule(getInput)
	
vizact.onkeydown(' ', inputScreen)
Reply With Quote