|
-
[Last Try] Highscore XML - Nearly there but...
INTRO
Hey everyone
Ok, so I have this game (well Ostil and I) that is completed and have also posted up here in the FK game section
Though it isnt all that great, its still quite the achievement for two new Flash Game makers. The final step is to make and complete a highscore system
BUT WAIT!
Before you go, Im not asking you to do it for me, because most of it is already done *phew* .. hopefully your still here
There is only one small (I hope) problem, which I have posted here in the Games and XML forum in the past and have yet to figure it out. I have also tried other forums without any success
So in one last desperate cry for help , I have resulted in posting up the single player .fla as well as the XML and ASP files and I really really hope someone here could help me. With this help, I can do endless things with xml , so I really would like to learn my mistakes
PROBLEM
The problem is this:
WHAT WORKS:
- I have an xml file that contains the player name and score of the top 10 highscores
- When you play single mode and 'die', it checks to see if you made at least the bottom of the highscores and then sends you to the highscore screen where you can input your name
- After entering your name and clicking the 'submit' button, it takes you back to the game over screen where you can choose to play again or go back to the menu
- If you check the xml file after this (or the highscore listings), the name successfully changes to the users name in the spot where he/she is now in the highscore
WHAT DOES *NOT* WORK:
- The score the player earned for some unknown reason does not change along with the player name.
For example:
Highscore 7 contains the name Matt with a score 8
Another user beats this highscore with 10 and inputs his name Bob , but the xml file only changed "matt" to "bob" and not the numbers
I have tried reading, forums, tutorials and I cannot find out whats wrong!, anyways, your my last hope folks ... so please help out 
Thanks everyone! *attaches*
CODE
Ok now where to look and find things:
1) .Fla the actual game
2) info.txt is the xml file, just save it as an xml since I cannot attach an xml file here
3) asp.txt is the asp file, just save that in dreamweaver or whatever as the asp file since I cannot attach asp files
Where the code is:
In the .fla the code lies on the very last frame of the time line on the 'submit score' button. It basically:
1) Creates an XML object that loads the xml file.
2) Has two arrays 'topScore' , 'name' which contains the name and score in the top list
3) It finally checks to see where the player should be and replaces the name and score (but the score doesnt work)
CONCLUSION
Well, I know this has been an extremely lengthly thread and one that most of you wont end up reading , so why am I addressing you ... haha
But I would appreciate ... no REALLY appreciate it if someone even looked into the problem. This has been bugging me for SO long and I just want it to end
Many thanks FK
Last edited by Osteel; 05-01-2009 at 02:39 AM.
-
Senior Member
Well, why not save score same way as name:
topScore[0] = my_xml.firstChild.firstChild.firstChild.nextSiblin g.childNodes[0];
And to compare it:
if (score>Number(String(topScore[0]))) {
name[0].nodeValue = insertName.text;
topScore[0] = score;
}
You still only replace the score which was beaten, but all other scores will remain unchanged. What it should do, is to add score in the place and move all weaker scores back by one and finally deleting last score (11th).
You may also get trouble if 2 players add scores same time, then only latest score is saved.
-
Hey thanks 
Ill try it now, but yea, I was worrying about the whole 'tie' and moving down list concept, but Ill work on that once the basics are complete
*Goes and tries*
-
**SIGH**
Sorry Tonypa, but unfortunatly that did not help, it still didnt change the highscore in the highscore listings nor the xml file
I got a score of 12 which beats the default top highscore of 10 and typed my name Matthew Ostil in. After doing so I checked both the highscore listing and the xml file
Only the name was changed, the score remained a horrifying 10 ...
...
-
WAIT ONE SECOND!!!!
Hahahaha, I GOT IT!!!!
So it did work your idea Tonypa , thanks SO much for your help 
My dreadful week here as finally come to an end .... I can rest easy tonight
Gotta love FK
-
*sheds a tear*
We can now move on with our lives brother, to accomplish more things then we thought were imaginable!
Thanks so much Tony =D
-Ostil-
-
Senior Member
Glad it helped
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|