You could change your code to this.
if keystate(31)=1 and controlkey()=1
if file exist("data.txt") then delete file "data.txt"
open to write 1,"data.txt"
write string 1,Str$(health#)
write string 1,Str$(score#)
close file 1
endif
You can also write floats to files so you could also do this, but it wouldn't be human-readable.
if keystate(31)=1 and controlkey()=1
if file exist("data.txt") then delete file "data.txt"
open to write 1,"data.txt"
write float 1,health#
write float 1,score#
close file 1
endif
To load it for the first example do this
`change the keystate check to the key you want to use to load
if keystate(31)=1 and controlkey()=1
if file exist("data.txt")
open to write 1,"data.txt"
read string 1,str$
health# = val(str$)
read string 1,str$
score# = val(str$)
close file 1
else
`do stuff if the file doesn't exist
endif
endif
And for the second example.
`change the keystate check to the key you want to use to load
if keystate(31)=1 and controlkey()=1
if file exist("data.txt")
open to write 1,"data.txt"
read float 1,health#
read float 1,score#
close file 1
else
`do stuff if the file doesn't exist
endif
endif
dbpro : 2ghz p4m : 512mb : geforce 4 4200 go