3 Replies Latest reply on May 6, 2014 4:01 AM by James Newton, ACP

    Changes to cast won't stay when I switch between .dir files

    lordofallkings

      Hello, first time on Adobe's forums.

       

      First of all, this is not my original script, I was hired to bring a game from old version of Director (I believe Director 5) into Director 11.5 so it will work on new Windows OSs.

      The game is broken into about 4 .dir files, and the Lingo script uses a cast named MathCityNaMu to save the game state when the players moves from one DIR file to the next.

       

      The script creates a cast member inside of the cast file called "MathCityNaMu". At first the cast only contains one member, called "kount". The script duplicates that cast member and inserts the players name and score into the newly created duplicate cast member via this script

           member("kount").duplicate()

           member("kount").name =string(MainCharacterName)

       

      The script then saves the cast by this line

           castLib("mathCityNaMu").save( "@casts\mathCityNaMu.cxt")

      And then when the second .dir file opens, it picks up the cast via this line.

           castLib("mathCityNaMu").filename = "@casts\mathCityNaMu.cxt"

       

      This process works when I play the game in Adobe Director. However, when I go to publish to an .exe, the functionality is lost. The .exe will hold all the character information until it makes the jump from one .dir file to another, when it loses it. It seems that for some reason the next .dir file will not pick up the right cast, or perhaps the cast is never getting saved properly in the first place. Anyway there is a lot going on in this script and I am willing to try anything. Please lend me some help!

        • 1. Re: Changes to cast won't stay when I switch between .dir files
          James Newton, ACP Level 3

          You are saving the cast with the .cxt extension, which Director considers as being a protected file. Does it help to use ".cst" as the extension?

          • 2. Re: Changes to cast won't stay when I switch between .dir files
            lordofallkings Level 1

            Thanks for replying!

             

            Unfortunately its not the CXT. I just found that it wasn't having any trouble picking up the cast file at all, that actually works.

             

            Instead it looks like, when I play the game in Director, when the game goes from one .dir to the next, it does NOT execute the handler "on startmovie"

            However, when I publish and do the executable, it seems that the game DOES execute "on startmovie" when switching from one .dir to the next. When it does this, it runs the start up scripts which refresh the name and scores and saved data. Does that sound like it could be correct??

             

            I may just have to re do a lot of the script. I'll keep posting updates. Thanks for the help!

            • 3. Re: Changes to cast won't stay when I switch between .dir files
              James Newton, ACP Level 3

              I'm not sure why startMovie() is not firing. I have not encountered that issue before.

               

              Here is a workaround that might ensure that a #startMovie event is sent.

              1. Create a timeout object with a period of 0 and an object as its target. Since the timeout will never be triggered when the period is 0, the name of the timeout handler is unimportant
              2. Set the persistence of the timeout to TRUE
              3. All system events in Movie Scripts will now be called twice.


              You can create an empty movie and give it this Movie Script, to test:


              global gWrapper

               

              on enterFrame()

                if not gWrapper then

                  gWrapper = script(1).create()

                end if

              end

               

               

              on startMovie(instance, timeOut)

                put instance, timeOut

              end

               

               

              on mouseUp()

                go movie the movie

              end

               

               

               

              on exitFrame()

                go the frame

              end

               

               

              -- TIMEOUT WRAPPER --

               

              on create(me)

                vTimeOut = timeOut().new("SystemEvents", 0, #nullHandler, me)

                vTimeOut.persistent = TRUE

                return true

              end create