10 Replies Latest reply on Aug 17, 2006 1:31 PM by Newsgroup_User

    Phantom error...

    Level 7
      Has this ever happened to you? You've got a nice piece of code going on,
      and you make some change, and all of a sudden, something seemingly totally
      unrelated stops working. You go around checking everything, changing
      ExitFrames to EnterFrames and vice-versa, commenting out lines, even
      reverting the change you made just before the code was changed, but it still
      doesn't work. Finally you start doing sanity checks like putting Alert
      commands in the offending script to see if the code is even running,
      removing and reapplying behaviors to the sprites that are supposed to be
      running it, and nothing works. No alerts appear, no "put" command makes
      anything happen in the message window. Finally in desperation, you quit
      Director, restart it, open up your project again, and everything works
      perfectly fine. There was never anything wrong with your code. Director
      just decided to mess with you and not run that particular script at all for
      some reason.

      As you might well guess, that just happened to me. And it's not the first
      time. Evidently, there's something that happens occasionally that causes a
      given script to just not run at all until you quit and restart the program.
      The worst part is it's nearly impossible to debug, because the bug isn't in
      your code. It's in the Director program itself deciding it doesn't want to
      run your code any more. So no amount of error checking will ever track it
      down, because there's nothing to track down. I guess I'll remember to quit
      and restart the program more often rather than waste hours trying to figure
      out why my code doesn't work...


        • 1. Re: Phantom error...
          Level 7
          Yes. Sometimes it's because you edit some code and leave the script in a way
          that doesn't cause it to automatically recompile. Clicking the compile all
          scripts button will do the same thing as exiting and restarting director.

          Other times I think it's due to sun spots or Mercury going retrograde.

          TR


          "Darrel Hoffman" <no.address@all.com> wrote in message
          news:ebqj6a$dce$1@forums.macromedia.com...
          > Has this ever happened to you? You've got a nice piece of code going on,
          > and you make some change, and all of a sudden, something seemingly totally
          > unrelated stops working. You go around checking everything, changing
          > ExitFrames to EnterFrames and vice-versa, commenting out lines, even
          > reverting the change you made just before the code was changed, but it
          > still
          > doesn't work. Finally you start doing sanity checks like putting Alert
          > commands in the offending script to see if the code is even running,
          > removing and reapplying behaviors to the sprites that are supposed to be
          > running it, and nothing works. No alerts appear, no "put" command makes
          > anything happen in the message window. Finally in desperation, you quit
          > Director, restart it, open up your project again, and everything works
          > perfectly fine. There was never anything wrong with your code. Director
          > just decided to mess with you and not run that particular script at all
          > for
          > some reason.
          >
          > As you might well guess, that just happened to me. And it's not the first
          > time. Evidently, there's something that happens occasionally that causes
          > a
          > given script to just not run at all until you quit and restart the
          > program.
          > The worst part is it's nearly impossible to debug, because the bug isn't
          > in
          > your code. It's in the Director program itself deciding it doesn't want
          > to
          > run your code any more. So no amount of error checking will ever track it
          > down, because there's nothing to track down. I guess I'll remember to
          > quit
          > and restart the program more often rather than waste hours trying to
          > figure
          > out why my code doesn't work...
          >
          >


          • 2. Re: Phantom error...
            the real POTMO Level 1
            it sounds as you have initialized a object in a global variable. When you replay, your object will still be there, aldough (spelling?) you have changed the script cos the object was built with the old script.
            So clear you globals or re-initialize the object.
            It can also be as mentioned above a compilation error. so recompile all scripts. And remove all breakpoints!
            • 3. Re: Phantom error...
              Level 7
              When that happens to me, I generally find that it is due to a global
              variable that has been set incorrectly somewhere. Sometimes, if that is
              the case, a clearGlobals() command will set things back to the way they
              were when the file 1st started. You can also do a showGlobals() to see
              the state of all your variables.

              Also, if you use parent scripts in the actorList, it often helps to
              clear it out when you are having strange issues

              the actorList=[]

              And I have also seen issues where I have setup a timeout object to run,
              then sometime during the program's execution, while the timeout is
              running, the program crashes without shutting down the timeout. So,
              when you hit Play again, it is still running, causing all sorts of
              mayhem. You can clear those out like this:

              the timeoutList=[]
              • 4. Re: Phantom error...
                Level 7
                I've also seen this happen (code doesn't run) to behavior scripts in D8.5
                and below if I've manually toggled the visibility of a sprite channel in
                the score to invisible. If I toggle it back to visible, the behaviors in
                that sprite channel work again. Simply navigating to another movie (go
                movie command) and back gets it working again, too.

                Not 100% reproduceable, but it is a pattern I've caught on many occasions.

                On Mon, 14 Aug 2006 20:32:43 GMT, tr posted in macromedia.director.lingo:

                > Yes. Sometimes it's because you edit some code and leave the script in a
                > way that doesn't cause it to automatically recompile. Clicking the
                > compile all scripts button will do the same thing as exiting and
                > restarting director.
                >
                > Other times I think it's due to sun spots or Mercury going retrograde.
                >
                > TR
                >
                >
                > "Darrel Hoffman" <no.address@all.com> wrote in message
                > news:ebqj6a$dce$1@forums.macromedia.com...
                >> Has this ever happened to you? You've got a nice piece of code going
                >> on, and you make some change, and all of a sudden, something seemingly
                >> totally unrelated stops working. You go around checking everything,
                >> changing ExitFrames to EnterFrames and vice-versa, commenting out
                >> lines, even reverting the change you made just before the code was
                >> changed, but it still
                >> doesn't work. Finally you start doing sanity checks like putting Alert
                >> commands in the offending script to see if the code is even running,
                >> removing and reapplying behaviors to the sprites that are supposed to
                >> be running it, and nothing works. No alerts appear, no "put" command
                >> makes anything happen in the message window. Finally in desperation,
                >> you quit Director, restart it, open up your project again, and
                >> everything works perfectly fine. There was never anything wrong with
                >> your code. Director just decided to mess with you and not run that
                >> particular script at all for
                >> some reason.
                >>
                >> As you might well guess, that just happened to me. And it's not the
                >> first time. Evidently, there's something that happens occasionally
                >> that causes a
                >> given script to just not run at all until you quit and restart the
                >> program.
                >> The worst part is it's nearly impossible to debug, because the bug
                >> isn't in
                >> your code. It's in the Director program itself deciding it doesn't
                >> want to
                >> run your code any more. So no amount of error checking will ever track
                >> it down, because there's nothing to track down. I guess I'll remember
                >> to quit
                >> and restart the program more often rather than waste hours trying to
                >> figure
                >> out why my code doesn't work...
                >>



                --
                Mark A. Boyd
                Keep-On-Learnin' :)
                • 5. Re: Phantom error...
                  Level 7
                  Well, in this particular project, there are no parent scripts, and no
                  timeout scripts. I never use breakpoints, and always recompile before
                  running. I could see the globals being an option, but I can't think of any
                  way that a global being set to anything would stop this script from running
                  AT ALL. I mean, I put an Alert at the beginning of the script before it
                  does anything else, and it still didn't run. (As in, right after "on
                  exitFrame me" No chance for it to even look at the globals before deciding
                  not to run the script.) I'm starting to think that sun spot theory may
                  actually be the most plausible in this situation...


                  • 6. Re: Phantom error...
                    Level 7
                    I just checked and Mercury went out of retrograde on July 28. So it's not
                    that.


                    "Darrel Hoffman" <no.address@all.com> wrote in message
                    news:ebqo2a$j2u$1@forums.macromedia.com...
                    > Well, in this particular project, there are no parent scripts, and no
                    > timeout scripts. I never use breakpoints, and always recompile before
                    > running. I could see the globals being an option, but I can't think of
                    > any
                    > way that a global being set to anything would stop this script from
                    > running
                    > AT ALL. I mean, I put an Alert at the beginning of the script before it
                    > does anything else, and it still didn't run. (As in, right after "on
                    > exitFrame me" No chance for it to even look at the globals before
                    > deciding
                    > not to run the script.) I'm starting to think that sun spot theory may
                    > actually be the most plausible in this situation...
                    >
                    >


                    • 7. Re: Phantom error...
                      Level 7
                      > I've also seen this happen (code doesn't run) to behavior scripts in D8.5
                      > and below if I've manually toggled the visibility of a sprite channel in
                      > the score to invisible. If I toggle it back to visible, the behaviors in
                      > that sprite channel work again. Simply navigating to another movie (go
                      > movie command) and back gets it working again, too.
                      >
                      > Not 100% reproduceable, but it is a pattern I've caught on many occasions.

                      Now that sounds possible, though the code should run on the script even when
                      it's invisible. I do toggle the visibility of this sprite regularly, and it
                      was code relating to that I'd changed before the error occurred. However,
                      that still doesn't explain why the code didn't run at all, even when it was
                      visible. (And I toggle it through code, not manually.) I know you can just
                      move the sprite off-screen instead, but in this case it's more practical to
                      just make it disappear, since the rect of the sprite constantly changes
                      whenever it's visible, so it's easier to just turn it on and off when
                      needed. (Sprite is a Line Shape object, with 1 point fixed on wherever the
                      mouseDown happened and the other following the mouse. Only visible when the
                      mouse button is down. The visibility part of the code was working fine, but
                      the code that makes the points move to the correct locations was not running
                      at all.)

                      Probably not reproduceable, but I've definitely seen similar occurances
                      before. Can't recall if sprite visibility was an issue in the previous
                      cases. But a close&restart always fixed it.


                      • 8. Re: Phantom error...
                        Level 7
                        On Mon, 14 Aug 2006 21:23:30 GMT, Darrel Hoffman posted in
                        macromedia.director.lingo:

                        > (And I toggle it through code, not manually.)

                        And through code, I use the off-stage method and haven't noticed this
                        pattern.

                        Sunspots.


                        --
                        Mark A. Boyd
                        Keep-On-Learnin' :)
                        • 9. Re: Phantom error...
                          Lukewig Level 1
                          Hi,

                          I had a similar problem once and discovered that referencing the scriptinstancelist of a not-yet initialised sprite will stop any scripts on that sprite for working (this is a bug, not a feature). For example, adding a behaviour like this to sprite 1 will prevent any behaviours on sprite 2 from working

                          on beginSprite me
                          foo = sprite(2).scriptinstanceList
                          end

                          Sprite 2 will be as dead-as-a-door-nail

                          -- Luke
                          • 10. Re: Phantom error...
                            Level 7
                            > And through code, I use the off-stage method and haven't noticed this
                            > pattern.
                            >
                            > Sunspots.

                            Definitely sunspots. Just had it happen again, and the only change I made
                            was color-coding some of the sprites on the score. Also locked a bunch of
                            them in the process. But didn't change any of the code at all, so it's
                            definitely not a compiler issue. Might be a memory thing, because there are
                            a rather large number of sprites in this movie. (Though a surprisingly
                            small cast compared to most of my projects.) When you select a lot of
                            sprites at the same time, the program slows to a crashing halt trying to
                            draw all those info-boxes. (Even if you turn off the info boxes, even just
                            drawing those manipulator rectangles around them seems to cause slow-downs
                            when you've got a lot of them.) I suspect this might have had something to
                            do with it.