9 Replies Latest reply on Jul 12, 2007 6:08 PM by wgb14

    How is it possible for this scripts to cause director crash

    wgb14 Level 1
      Hi all,

      I have this scripts that are driving me crazy. For some unknown reason it causes director crash. Can someone please help me and tell me why and if possible suggest an alternative? It is a standard property list manipulation.

      global myscoreList,rate,myscorecount

      on delscore

      sText = ""

      myscoreList.deleteProp (#question & myscorecount)

      n = count (myscoreList)

      myscorecount = myscorecount - 1

      repeat with i = 1 to n
      tText1 = myscoreList
      sText1 = sText1 & tText1 & RETURN

      end repeat
      delete the last char of sText1
      -- place ALL text into text member
      member("ratings").text = sText1

      end
        • 1. Re: How is it possible for this scripts to cause director crash
          Level 7
          wgb14 wrote:
          > I have this scripts that are driving me crazy. For some unknown
          > reason it causes director crash. Can someone please help me and tell
          > me why and if possible suggest an alternative? It is a standard
          > property list manipulation.
          >
          > global myscoreList,rate,myscorecount
          >
          > on delscore
          >
          > sText = ""
          >
          > myscoreList.deleteProp (#question & myscorecount)

          Did you mean
          myscoreList.deleteProp(symbol("question" & myscorecount))

          ?

          Andrew


          • 2. Re: How is it possible for this scripts to cause director crash
            wgb14 Level 1
            This is the second handler that is called from the same button that causes my director to crash... if you can help please let me know...

            the button that I have attached the behaviour that cllas the two handlers is a pushbutton fromt he OS xtra.

            global myQuestionList1,myQuestionList3,myQuestionList4,myQuestionList5
            global gWhichQ,question,gfilewrite,language,gFileList,gFileIndex,rate,typeagent

            on previoushandler

            gWhichQ = gWhichQ - 1 -- number of total questions

            CASE (language) OF
            "Greek": put "Åñþôçóç" & SPACE & gWhichQ &SPACE & "áðï 100" into member("questions_total")
            "English": put "Question" & SPACE & gWhichQ &SPACE & "from 100" into member("questions_total")
            END CASE

            --------------------- Accesibility Questionaire (4 QUESTIONS) -------------------------------
            --------------------- First part

            CASE (TRUE) OF
            (gWhichQ < 2): -- total number of image questions is two
            backFile
            sprite(13).enabled = FALSE
            baDeleteIniEntry("Yes-No Questions",gFileList[gFileIndex], the moviePath & "Qanswers\"&gfilewrite&"" & ".ini")
            END CASE
            CASE (TRUE) OF
            (gWhichQ = 2):
            _movie.go(1)
            sprite(4).locH = 32
            sprite(4).locV = 121
            CASE (language) OF
            "Greek":
            member("instructions").text = "Ðáñáêáëþ áðáíôÞóôå åßôå ìå íáé ç ü÷é:"
            member("questions_stage").text = "ÊáôÜ ôçí äéÜñêåéá ôçò îåíÜãçóçò ìáò åßäáôå áõôü ôï áíôéêåßìåíï;"
            "English":
            member("instructions").text = "Please answer with either yes or no:"
            member("questions_stage").text = "During our tour did you see this object?"
            END CASE
            END CASE
            -------------------- Second part

            CASE (TRUE) OF
            (gWhichQ > 2 AND gWhichQ < 4):
            tPos = myQuestionList1.getPos(member("questions_stage").text)
            if tPos <= count(myQuestionList1) then
            member("questions_stage").text = myQuestionList1[tPos - 1]
            baDeleteIniEntry("Accesibility_Likert_Questions",question, the moviePath & "Qanswers\"&gfilewrite&"" & ".ini") -- delete entry from the file
            end if
            END CASE

            CASE (TRUE) OF
            (gWhichQ = 4): -- 4 is maximum number of textual questions
            member("questions_stage").text = myQuestionList1[2] -- last question of the accesibility questionaire
            baDeleteIniEntry("Usability_Questions",question, the moviePath & "Qanswers\"&gfilewrite&"" & ".ini") -- delete entry from the file
            CASE (language) OF
            "Greek":
            member("title").text = "Åñùôçìáôïëüãéï 1"
            member("Instructions").text = "Ãéá êÜèå ìéá áðü ôéò öñÜóåéò ðáñáêÜôù, ðáñáêáëþ ðåßôå ìáò ðüóï êáëÜ ðåñéãñÜöåé ôï óýóôçìá:"
            "English":
            member("title").text = "Questionaire 1"
            member("Instructions").text = "For each phrase below, please indicate how well it describes the system:"
            END CASE
            END CASE
            -------------- Second questionaire (usability) (2 QUESTIONS - 5 & 6)--------------------

            CASE (TRUE) OF
            (gWhichQ > 4 AND gWhichQ < 6):
            tPos = myQuestionList3.getPos(member("questions_stage").text)
            if tPos <= count(myQuestionList3) then
            member("questions_stage").text = myQuestionList3[tPos - 1]
            baDeleteIniEntry("Usability_Questions",question, the moviePath & "Qanswers\"&gfilewrite&"" & ".ini") -- delete entry from the file
            end if
            END CASE
            CASE (TRUE) OF
            (gWhichQ = 6):
            baWriteIni("Usability_Questions",question, ""&rate&"", the moviePath & "Qanswers\"&gfilewrite&"" & ".ini")
            tPos = myQuestionList3.getPos(member("questions_stage").text)
            if tPos <= count(myQuestionList3) then
            member("questions_stage").text = myQuestionList3[tPos - 1]
            baDeleteIniEntry("Usability_Questions",question, the moviePath & "Qanswers\"&gfilewrite&"" & ".ini") -- delete entry from the file
            end if
            END CASE

            -------------------- Third questionaire (first part 7 & 8) -------------------------

            CASE (TRUE) OF
            (gWhichQ > 6 AND gWhichQ < 8):
            member("questions_stage").text = myQuestionList3[2] -- last question of the usability questionaire
            baDeleteIniEntry("Usability_Questions",question, the moviePath & "Qanswers\"&gfilewrite&"" & ".ini") -- delete entry from the file

            CASE (language) OF
            "Greek":
            member("title").text = "Åñùôçìáôïëüãéï 2"
            member("Instructions").text = "Ãéá êÜèå ëÝîç/ðñüôáóç ðáñáêÜôù, ðáñáêáëþ ðåßôå ìáò ðüóï êáëÜ ðåñéãñÜöåé ôï óýóôçìá:"
            "English" :
            member("title").text = "Questionaire 2"
            member("Instructions").text = "For each word/phrase below, please indicate how well it describes the system:"
            END CASE
            END CASE
            CASE (TRUE) OF
            (gWhichQ = 8):
            tPos = myQuestionList4.getPos(member("questions_stage").text)
            if tPos <= count(myQuestionList4) then
            member("questions_stage").text = myQuestionList4[tPos - 1]
            baDeleteIniEntry("Tour_Guide_Questions(a)",question, the moviePath & "Qanswers\"&gfilewrite&"" & ".ini") -- delete entry from the file

            end if
            END CASE
            ------------------------------- second part of third questionaire (9 & 10) (valid only in the present condition) -------------------------
            CASE (typeagent) OF
            "Pr":
            CASE (TRUE) OF
            (gWhichQ > 8 AND gWhichQ < 10):
            member("questions_stage").text = myQuestionList4[2] -- last question of the usability questionaire
            baDeleteIniEntry("Tour_Guide_Questions(a)",question, the moviePath & "Qanswers\"&gfilewrite&"" & ".ini") -- delete entry from the file
            END CASE
            CASE (TRUE) OF
            (gWhichQ = 10):
            tPos = myQuestionList4.getPos(member("questions_stage").text)
            if tPos <= count(myQuestionList5) then
            member("questions_stage").text = myQuestionList5[tPos - 1]
            baDeleteIniEntry("Tour_Guide_Questions(b)",question, the moviePath & "Qanswers\"&gfilewrite&"" & ".ini") -- delete entry from the file
            end if
            END CASE
            END CASE
            end
            • 3. Re: How is it possible for this scripts to cause director crash
              wgb14 Level 1
              The suggestion of Andrew improved things but the crashing is so random that i can never be sure. If you have any suggestions on how to improve the previoushandler please let me know. You can't imagine how valuable your help is to me. many thanks
              • 4. Re: How is it possible for this scripts to cause director crash
                Level 7
                wgb14 wrote:
                > The suggestion of Andrew improved things but the crashing is so
                > random that i can never be sure. If you have any suggestions on how
                > to improve the previoushandler please let me know. You can't imagine
                > how valuable your help is to me. many thanks

                Look through to see if you have any other places where you are mixing
                variable types.

                In the one I pointed out, you were adding a number to a symbol, and
                unfortunately Director does not alert you to that, it just does some
                operation on some data, which may or may not be what you want.

                For example,

                -- Welcome to Director --
                put 1+1
                -- 2
                put 1+"1"
                -- 2.0000
                put #x +1
                -- 948

                Also, put in breakpoints and see what values variables take in the debugger.

                Andrew


                • 5. Re: How is it possible for this scripts to cause director crash
                  tedalde2 Level 2
                  Your second script is tough to read, it's pretty long. If you don't know where the error is occurring, try putting meaningful "put" statements throughout the script. That way you can see what last executed in the message window before the crash. Sometimes that’s the only way to simplify a random crash like that.
                  • 6. How is it possible for this scripts to cause director crash
                    McFazstp Level 1
                    What version of director are you using? Do you get an error message or a crash? In MX and lower if you put more than something like 650 chars into a text field with no line wrap it will cause a crash.

                    You could try;
                    member("ratings").wordWrap = TRUE
                    member("ratings").text = sText1
                    • 7. Re: How is it possible for this scripts to cause director crash
                      wgb14 Level 1
                      Hi I am using Director MX 2004. I am getting a full crash not an error message....
                      • 8. Re: How is it possible for this scripts to cause director crash
                        McFazstp Level 1
                        Does it always crash when you are using Greek text or equally with Greek and English?
                        • 9. Re: How is it possible for this scripts to cause director crash
                          wgb14 Level 1
                          The crash is completely random and it happens in both English and Greek....