2 Replies Latest reply on Jan 11, 2012 4:18 PM by Sean_Wilson

    Help identifying what If/then values represent


      I am a complete newbie to Director AND script writing and am trying to unravel lingo for a game because a few of the behaviors are not working.  Can anyone tell me what the numbers for the <> statements mean in the following script? eg, in the range for report 7, what do the numbers "404, 436, 438, 478" etc, represent? Thanks!



      on mouseUp


        -- local variables defined

        currCast20 = sprite(26).membernum + sprite(24).membernum + sprite(22).membernum + sprite(28).membernum + sprite(30).membernum + sprite(16).membernum + sprite(14).membernum + sprite(12).membernum + sprite(10).membernum

        currCast25 = sprite(26).membernum + sprite(24).membernum + sprite(22).membernum + sprite(32).membernum + sprite(18).membernum + sprite(16).membernum + sprite(14).membernum + sprite(12).membernum + sprite(10).membernum



        -- select entire river only

        if currCast20 = 476 then go to "report 5"

        -- center panel selected, develops river from center down

        if currCast25 = 437 then go to "report 8"

        -- range for report 5

        if currCast20>404 and currCast20 <436 then go to "report 5"

        if currCast20>438 and currCast20 <478 then go to "report 5"

        -- range for report 7

        if currCast25>404 and currCast25 <436 then go to "report 7"

        if currCast25>438 and currCast25 <478 then go to "report 7"

        if currCast25>334 and currCast25 <403 then go to "report 7"

        if currCast25>405 and currCast25 <409 then go to "report 7"

        -- range for report 3

        if currCast25>305 and currCast25 <321 then go to "report 3"

        if currCast25>218 and currCast25 <287 then go to "report 3"



        • 1. Re: Help identifying what If/then values represent
          pallottadesign Level 1

          The first part of the behavior, under "--local variables defined" is adding the cast numbers (membernum) for several sprites and is putting the total value into a variable, i.e. "currCast20"


          The next part of the behavior is checking that total value and is executing go to marker statements that depend upon the total.


          The reason the IF statements use > and < symbols is because the IF statement is testing for a value that falls within a range. For example, in the "range for report 5" statements, the first IF statement is checking for any value that falls between the lowest value of 404 and the highest value of 436, that is, 405 through 435.


          The other IF statements test for different ranges.


          Because the code is "hard coded" for specific sprite numbers, the behavior can be easily broken if sprites are moved to different channels in the score, and possibly if the cast was an external cast that is not in the correct location on disk, or if the cast members have been moved around within the cast itself.

          • 2. Re: Help identifying what If/then values represent
            Sean_Wilson Adobe Community Professional

            They represent the summed total of a number of different sprite's member numbers. That is, every sprite has an associated cast member, and every cast member is located in a numbered slot in a cast library. If you take all the sprites in question (26, 24, 22, 32, 18, 16, 14, 12 and 10) and add the member numbers referenced by all these sprites then you generate the (local) variable 'currCast25'


            This is meaningless to anyone without more context - like seeing how the cast library and score is laid out (effectively the entire movie file). What's more, referencing cast members by number (memberNum) should be avoided at all costs when writing a script because if you move a single such referenced cast member then your script suddenly doesn't work. Much more sensible to refer to members by name instead of number.