Window.Open and opening a written file
Author |
Message |
DarkMastermind
|
Posted: Mon Jun 20, 2005 5:32 pm Post subject: Window.Open and opening a written file |
|
|
I am trying to make a Pacman-type game, and at the end I would like to display a high-score table... The way I was planning on doing this was by writing to a file the user's score, then opening a new window and outputting the information stored in the file, which would probably be "highscores.txt" or whatever. I can't remember how I would take the user's name, score, and time to put into the file. So far, I have the very first line, I think, with variables already declared:
code: | open: file, "highscores.txt",put |
I'm not sure where to go after that... Someone please refresh my memory? |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Cervantes
![](http://compsci.ca/v3/uploads/user_avatars/1023105758475ab2e040bde.jpg)
|
Posted: Mon Jun 20, 2005 6:16 pm Post subject: (No subject) |
|
|
Instad of opening with the intension of putting stuff, open if for [/b]get[/b] and put. Get all the data into an array, add the current user's score to the array (you should be using a flexible array), sort the array, then write the top 10 (or whatever) elements back.
For flexible arrays and file I/O, there are tutorials in the Turing Tutorials section. For sorting, check the Turing source code forum for a topic by Zylum called "sorting procedures". |
|
|
|
|
![](images/spacer.gif) |
|
|