Write the values as memblock.
Here is example:
type PlayerData
xp as integer
health as integer
Level as integer
canupgrade as integer
dead as integer
won as integer
oldpositionz as float
oldpositiony as float
endtype
REM SET VALUES
dim player(0) as PlayerData
player(0).xp = 12306
player(0).health = 78
player(0).Level = 36
player(0).canupgrade = 0
player(0).dead = 0
player(0).won = 1
player(0).oldpositionz = 550.0
player(0).oldpositiony = 444.0
REM WRITE TO MEMBLOCK
if file exist("player.dat") then delete file "player.dat"
open to write 1, "player.dat"
make memblock from array 1, player()
write memblock 1, 1
delete memblock 1
close file 1
REM CLEAR VALUES
player(0).xp = 0
player(0).health =0
player(0).Level = 0
player(0).canupgrade = 0
player(0).dead = 0
player(0).won = 0
player(0).oldpositionz =0
player(0).oldpositiony = 0
REM READ FROM MEMBLOCK
open to read 1, "player.dat"
read memblock 1, 1
make array from memblock player(), 1
delete memblock 1
close file 1
REM PRINT VALUES
print "Read From Memblock:"
print player(0).xp
print player(0).health
print player(0).Level
print player(0).canupgrade
print player(0).dead
print player(0).won
print player(0).oldpositionz
print player(0).oldpositiony
wait key
Go to %temp% folder and open the "player.dat"(or save it where you want to see it), you will see
Which is unreadable and unmodifyable, but when you load the memblock you can use the values.