WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   wierd problem (https://forum.worldviz.com/showthread.php?t=938)

krimble 12-19-2006 02:56 AM

wierd problem
 
Hello,

I'm coding a virtual room with paintings, a spider and some textures with years on it.
Everytime I hit the spacebar the positions of the paintings, the spider and the years have to change (the positions are in a dictionary).

The problem starts when I add 2 lines of code with commands to change the positions of the years. (see the arrows on the end of those lines)
When teller == 2 it goes to except index error and it prints "consider it done". When I remove those 2 lines it goes through the loops and everything works normal.

What is wrong with those two lines ??? (i'm getting no errors)

Code:

def mykeyboard(key) :
        global volgorde, teller, teller2, speed
       
        if key == " " :
               
                try :
                        if teller < 4 :
                                bordTEX.texture(viz.add(B_blur[teller]))
                               
                                spider.translate(-19,5,13.05)
                                spider.rotate(180,90,0)
                               
                                spot.translate(-17,5,-12.99)
                                spot.rotate(0,0,180)
                                print teller
                               
                                if teller == 2 :
                                        for getal in xrange(1, 15) :
                                                paintings[getal].texture(viz.add(P[volgorde[teller][getal-1]]))
                                       
                                                jaartallenDict[getal].texture(viz.add(jaartallen[volgorde[teller][getal-1]])) <----------
                                               
                                                spider.translate(POS_dict[s[teller-1]]['spiderPos']["translate"])
                                                spider.rotate(POS_dict[s[teller-1]]['spiderPos']["rotate"])
                       
                        else :
                                teller2 +=1
                                bordTEX.texture(viz.add(B[4]))
                                bordTEX.scale(3,1.5,2)
                               
                                for i in xrange(1, 15) :
                                        # apply the paintingtexture to the paintings in the given order out of the volgordelist
                                        paintings[i].texture(viz.add(P[volgorde[teller2][i-1]]))
                                       
                                        # apply the jaartaltexture to the jaartallen in the given order out of the volgordelist
                                        jaartallenDict[i].texture(viz.add(jaartallen[volgorde[teller2][i-1]]))    <----------------
                                       
                                        # apply the jaartal textures to bord
                                        bordTEX.texture(viz.add(jaartallen[teller2-1]))
                                       
                                        # change the position of the spider per trial
                                        spider.translate(POS_dict[s[teller2]]['spiderPos']["translate"])
                                        spider.rotate(POS_dict[s[teller2]]['spiderPos']["rotate"])
                                       
                                        # change the position of the spot per trial
                                        spot.translate(POS_dict[s[teller2]]['spotPos']["translate"])
                                        spot.rotate(POS_dict[s[teller2]]['spotPos']["rotate"])
                       
                        teller +=1

                except IndexError :
                        # end of experiment everything gets invisible
                        kamer.visible(0)
                        bord.visible(0)
                        bordTEX.visible(0)
                        spider.visible(0)
                        spot.visible(0)
                       
                        for paint in paintings.values() :
                                paint.visible(0)
                               
                        print "CONSIDER IT DONE!!!!!!!!!"


krimble 12-19-2006 04:09 AM

I've solved the problem, the list of of year textures was to short, STUPID !!!


All times are GMT -7. The time now is 05:10 PM.

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