Computer Science Canada read from file question |
Author: | commandos [ Thu May 01, 2008 9:50 pm ] |
Post subject: | read from file question |
I'm trying to make a RPG game and i want the user to be able to save the game and open it when they feel like it. So i have all the stats of the character saved on a save file. the layout of the save file is exactly like this Level 1 Experience 25 Health 85 and so on... When the user decides to open a saved game, I want the program to read every other line (the values) and put them as variables in the code. Any idea of how i can get the program to just read the values and take them as an array of integers? |
Author: | TheFerret [ Thu May 01, 2008 10:07 pm ] |
Post subject: | RE:read from file question |
Save just the numbers and just ignore the words... so it would be like: 1 25 85 and so on... |
Author: | commandos [ Thu May 01, 2008 10:18 pm ] |
Post subject: | RE:read from file question |
I was thinking of doing that but then it would make it harder for me to follow the text file since I'll probably have to play around with the numbers a bit. Is there any way to get the program to read every other line? |
Author: | commandos [ Thu May 01, 2008 10:34 pm ] | ||
Post subject: | RE:read from file question | ||
Nevermind i found a solution... may not bed the best but it works and thats good enough for me right now lol
|
Author: | Mackie [ Thu May 01, 2008 10:59 pm ] | ||
Post subject: | RE:read from file question | ||
Try this instead:
|