nilesmitchell wrote:
I'm getting closer. I took out the commas and list each item on it's own line. I have this so far...
dim invsaved as FolderItem = SpecialFolder.ApplicationData.child("Zombie Game").child("Saved Game.txt")
Dim textInput As TextInputStream
Dim invsavedlist As String
textInput =TextInputStream.Open(invsaved)
invsavedlist=textInput.Readall
So how do I do some thing like.......
if invsavedlist contains "Pistol" then
pistol = 1
else
pistol = 0
end
because that doesn't work! LOL
if insavedlist.instr("Pistol") > 0 then
Note that if you put each item on it's own line, you need to make sure that each item either has a blank line if it is not present, or you will need to make sure you know how to parse out any other information (such as your window name which could be on a different line depending on how many items exist)
It would be best to structure your text file a little more consistently - i.e - you could use a named pair for each line, then parse each line for the name and value
Quote:
Pistol:1
Crossbow:0
Shotgun:1
WindowName:Entry
This way, if you need to add/remove values in the future, you are less likely to run into problems.
Writing to an XML file would also be an option.