4 Replies Latest reply on May 3, 2007 9:33 AM by Newsgroup_User

    Can someone tell me where I have went wrong?

    npo rule Level 1
      Hi

      I am creating a high score table for my target game and this is the code I have for it:

      if gPoints > the text of member "points1" then
      put gPoints into member "points1"
      put gHits into member "Hits1"


      else if gPoints > the text of member "points2" && gPoints < the text of member "points1" then
      put gPoints into member "points2"
      put gHits into member "Hits2"


      else if gPoints > the text of member "points3" && gPoints < the text of member "points2" then
      put gPoints into member "points3"
      put gHits into member "Hits3"


      I know this isnt the easiest way of doing it but I dont understand property lists etc
      Whats happening is that the high score table isnt updating right when the player finishes the game. For example if the table currently stands at 1st = 200 points 2nd = 150 points and 3rd = 100 points. If a user gets 150 points it puts 160 points into both 2nd and 3rd place. Or if a user gets 70 points it puts it into 2nd place. I dont know how to fix this.

      Any help is greatly appreciated.
        • 1. Re: Can someone tell me where I have went wrong?
          Level 7
          Well for starters the double and signs (&&) is meant for string
          concatenation. You should be using the word AND in your expression. Also I
          would suggest you read up on how to use the CASE statement. It is meant to
          be used in situations like this so that you don't have multiple 'else if
          something is true then....else if somethingelse is true then...' It is easy
          to use and makes for cleaner and more efficient code.

          "npo rule" <webforumsuser@macromedia.com> wrote in message
          news:f1cmh6$fvc$1@forums.macromedia.com...
          > Hi
          >
          > I am creating a high score table for my target game and this is the code I
          > have for it:
          >
          > if gPoints > the text of member "points1" then
          > put gPoints into member "points1"
          > put gHits into member "Hits1"
          >
          >
          > else if gPoints > the text of member "points2" && gPoints < the text of
          > member
          > "points1" then
          > put gPoints into member "points2"
          > put gHits into member "Hits2"
          >
          >
          > else if gPoints > the text of member "points3" && gPoints < the text of
          > member
          > "points2" then
          > put gPoints into member "points3"
          > put gHits into member "Hits3"
          >
          >
          > I know this isnt the easiest way of doing it but I dont understand
          > property
          > lists etc
          > Whats happening is that the high score table isnt updating right when the
          > player finishes the game. For example if the table currently stands at 1st
          > =
          > 200 points 2nd = 150 points and 3rd = 100 points. If a user gets 150
          > points it
          > puts 160 points into both 2nd and 3rd place. Or if a user gets 70 points
          > it
          > puts it into 2nd place. I dont know how to fix this.
          >
          > Any help is greatly appreciated.
          >
          >


          • 2. Re: Can someone tell me where I have went wrong?
            Level 7
            Yes. It should be "...where I have gone wrong?"

            --
            Craig Wollman
            Lingo Specialist
            Word of Mouth Productions
            212-928-9581

            www.wordofmouthpros.com
            "npo rule" <webforumsuser@macromedia.com> wrote in message
            news:f1cmh6$fvc$1@forums.macromedia.com...
            > Hi
            >
            > I am creating a high score table for my target game and this is the code I
            > have for it:
            >
            > if gPoints > the text of member "points1" then
            > put gPoints into member "points1"
            > put gHits into member "Hits1"
            >
            >
            > else if gPoints > the text of member "points2" && gPoints < the text of
            > member
            > "points1" then
            > put gPoints into member "points2"
            > put gHits into member "Hits2"
            >
            >
            > else if gPoints > the text of member "points3" && gPoints < the text of
            > member
            > "points2" then
            > put gPoints into member "points3"
            > put gHits into member "Hits3"
            >
            >
            > I know this isnt the easiest way of doing it but I dont understand
            > property
            > lists etc
            > Whats happening is that the high score table isnt updating right when the
            > player finishes the game. For example if the table currently stands at 1st
            > =
            > 200 points 2nd = 150 points and 3rd = 100 points. If a user gets 150
            > points it
            > puts 160 points into both 2nd and 3rd place. Or if a user gets 70 points
            > it
            > puts it into 2nd place. I dont know how to fix this.
            >
            > Any help is greatly appreciated.
            >
            >


            • 3. Can someone tell me where I have went wrong?
              npo rule Level 1
              sorry im dyslexic but thanks for pointing my mistake out Craig hopefully i will remember but i didnt come here to be corrected on my english.

              Dave - thanks very much i know how to use case statements but didnt even think of using them! thanks again will give them a try and see how it goes :)
              • 4. Re: Can someone tell me where I have went wrong?
                Level 7
                No problem. I don't think it's dyslexia though, just a simple grammar
                mistake.



                --
                Craig Wollman
                Lingo Specialist
                Word of Mouth Productions
                212-928-9581

                www.wordofmouthpros.com
                "npo rule" <webforumsuser@macromedia.com> wrote in message
                news:f1cp21$j3g$1@forums.macromedia.com...
                > sorry im dyslexic but thanks for pointing my mistake out Craig ill try
                > hopefully i will remember but i didnt come here to be corrected on my
                > english.
                >
                > Dave - thanks very much i know how to use case statements but didnt even
                > think
                > of using them! thanks again will give them a try and see how it goes :)
                >