WorldViz User Forum iteration over non-sequence error
 Register FAQ Search Today's Posts Mark Forums Read

#1
03-02-2009, 07:57 AM
 just alex Member Join Date: Nov 2008 Posts: 18
iteration over non-sequence error

This is another noobie question, but whenever I activate what should be the car's driving path, i get a iteration over non-sequence error and I'm not sure how to fix it.

Code:
```import viz
import math
import vizmat
import vizinfo
import vizact
from lookingat import LookingAt
viz.go()

#PORT_PPT = 1

#ppt.command(3,"",1,1,5) #scales ppt tracking on xyz axis

#collisions on
viz.collision(viz.ON)
view = viz.get(viz.MAIN_VIEWPOINT)
view.rotate(0,1,0,90)

#gonna comment out the collision for now, it's registering when the avatar touches
#ground as a collision

#This function is called when a collision occurs
def mycollision(info):
print 'Collided'

#Create a callback for a collision event
viz.callback(viz.COLLISION_EVENT, mycollision)

#PORT_INTERSENSE = 2
#viz.tracker()
#tracker.reset()

def mykeyboard(key):

#If the R key is pressed, reset the head orientation
if key in ['r','R']:
tracker.reset()

#Create a keyboard callback
viz.callback(viz.KEYBOARD_EVENT,mykeyboard)

#Add the street and drop it a little bit to be below the avatars feet.
street.translate(0,-.2,0)

males = []
females = []
walking = []
whichturn = 0

#List the timers.
WALKING = 0
DRIVING = 1
BLINDLOOK = 2
MALEMEETING = 3
FEMALEMEETING = 4
SITTINGWOMAN=5
FREEZESITTER=6
THROWINGMAN =7
HOLDVIEW = 8
TIMING = 9

bodyparts = ['male_legs.cmx','male_torso_LS.cmx','male_shoes.cmx']
maleclothes = ['Male/clothes/male1.jpg','Male/clothes/male2.jpg','Male/clothes/male3.jpg']
#Make some avatars.
for i in range(3):
male.translate(i,0,0)
for j in bodyparts:
male.texture(clothes,j)
males.append(male)

for i in range(2):
female.translate(i,0,0)
females.append(female)

#Set up paramters for walking guy.
males[0].translate(0,0,-5)
males[0].rotate(0,1,0,-90)
males[0].whichturn = 0
males[0].set = [[1.5,0,-5],[1.5,0,15],[5,0,15],[-5,0,-5]]
males[0].end = 4
males[0].state(1)
walking.append(males[0])

#Set up paramters for walking girl.
females[0].translate(1,0,-7)
females[0].rotate(0,1,0,-90)
females[0].whichturn = 0
females[0].set = [[1.5,0,0],[1,0,15],[2,0,15],[-5,0,-5]]
females[0].end = 4
females[0].state(1)
walking.append(females[0])

#set car stuff
car.translate(-1.5,0,8)
car.rotate(0,1,0,180)

#set car path
positions = [[-1.5,0,8],[-1.5,0,0],[-1.5,0,-3]]

for x in range(0,len(positions)):
cp.setPosition(positions[x])

path.constantspeed(viz.ON,1)

path.loop(viz.LOOP)

path.translatemode(viz.BEZIER)

path.setAutoRotate(viz.ON)

#Set up for meeting.
males[1].translate(-9,0,21)
females[1].translate(2,0,7)
females[1].state(1)
malemoves = [2,2,4,4,2,4,4,4,4,4,4,2,2,12]
femalemoves = [6,5,12,12,1]
females[1].rotate(0,1,0,-55)
males[1].rotate(0,1,0,135)
males[1].state(1)

#Set up for throwing man.
males[2].translate(11,0,7)
males[2].state(1)

#Set up for timing.
timebomb = 0

def onkeydown(key):
if key == '0':
viz.starttimer(WALKING, .1, viz.PERPETUAL)

if key == '2':
males[1].goto(1.6,0,7.7)
females[1].spinto(0,1,0,-55)
females[1].state(12)
viz.starttimer(MALEMEETING,.1)
viz.starttimer(FEMALEMEETING,.1)

if key == '7':
viz.starttimer(DRIVING,.1)

if key == '4':
viz.starttimer(THROWINGMAN,.1)

if key == 's':
print 's'
viz.starttimer(TIMING,1, viz.PERPETUAL)

def ontimer(num):
global gravity, timebomb
if num == WALKING:
for agent in walking:
agentposition = agent.get(viz.POSITION)
agentgap = vizmat.Distance(agentposition, agent.set[agent.whichturn])
if agentgap < .1:
agent.whichturn += 1
agent.state(1)
if agent.whichturn == agent.end:
agent.whichturn = 0

walk = vizact.walkto(agent.set[agent.whichturn][0],agent.set[agent.whichturn][1],agent.set[agent.whichturn][2])

if num == DRIVING:
for agent in DRIVING:
path.play()

if num == MALEMEETING:
if len(malemoves)>1:
animation = malemoves.pop(0)
duration = males[1].getduration(animation)
males[1].execute(animation)
viz.starttimer(MALEMEETING, duration-.15)
else:
animation = malemoves.pop(0)
males[1].state(animation)

if num == FEMALEMEETING:
if len(femalemoves)>1:
animation = femalemoves.pop(0)
duration = females[1].getduration(animation)
females[1].execute(animation)
viz.starttimer(FEMALEMEETING, duration-.15)
else:
animation = femalemoves.pop(0)
females[1].state(animation)

if num == THROWINGMAN:
males[2].execute(9)
males[2].execute(1)
viz.starttimer(THROWINGMAN, 10)

if num == HOLDVIEW:
view.translate(-8.5,1.5,-2)

if num == TIMING:
print timebomb
timebomb += 1

if timebomb == 1:
onkeydown('0')

elif timebomb == 3:
onkeydown('4')

elif timebomb == 10:
onkeydown('2')

elif timebomb == 20:
onkeydown('3')

elif timebomb == 30:
onkeydown('1')

elif timebomb == 80:
viz.quit()

viz.callback(viz.TIMER_EVENT,ontimer)

viz.callback(viz.KEYDOWN_EVENT,onkeydown)
viz.starttimer(HOLDVIEW,.001, viz.PERPETUAL)```

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Getting Vizard Help with AI Announcements Vizard Precision Position Tracker (PPT) Plug-in development

 Similar Threads Thread Thread Starter Forum Replies Last Post dan12345 Vizard 7 07-28-2008 04:24 AM Jerhy Vizard 1 02-28-2006 01:59 PM Vygreif Vizard 1 10-03-2005 04:50 PM vjonshih Vizard 1 05-23-2005 12:21 PM FlyingWren Vizard 2 12-02-2003 08:23 AM

All times are GMT -7. The time now is 10:57 AM.