View Single Post
  #1  
Old 12-23-2008, 03:58 PM
TrashcanPatrol TrashcanPatrol is offline
Member
 
Join Date: Aug 2008
Posts: 43
Writing data more than once

Hi, I tried a script to write data to a file outside of Vizard.

Code:
import viz
viz.go()

room=viz.add('room.wrl')
viz.collision(viz.ON)
import vizcam
vizcam.FlyNavigate()
subject = viz.input('Who are you?')

scoreLabel.score = 0
RECT3_X = -2
RECT3_Z = -2
RECT3_WIDTH = 0.5
Readboard = False
#score_data = open('quest_data','a','U')
def handlemyhotspots(id,x,y,z):
	global Readboard

	if id == BOARD:
		Readboard = True
		print 'Board has been read. +1'
		data = 'Mr. ' + str(subject) + ' was given 1 point for reading the instructions. '
	score_data.write(data)
	score_data.flush()
viz.starthotspot(BOARD,viz.RECTANGLE_HOTSPOT_IN,RECT3_X,RECT3_Z,RECT3_WIDTH,1)
That's part of the code. I'm trying to add another portion where if the player selects an object, data is written to the file score_data to say "Mr. ____ selected Item."
I can't seem to combine the two, or even get the second part of it to work by itself. Can anyone help me fix the problem?
Reply With Quote