I am trying to write a high score to a file when the high score is greater than the previous one, and display the high score as text. However, whenever I run this code, I get a reading of 0 even if the score is above 0. Can anyone please tell me where I'm going wrong? I'm a newbie to writing and opening files... Thank you!
Highscore as integer
If lives = 0 and highscore > score
highscore = score
opentowrite(1, "high_score.dat")
writeinteger(1, highscore)
closefile(1)
Endif
if GetFileExists("high_score.dat") = 1
File = OpenToRead("High_Score.dat")
HighScore = ReadInteger(1)
CreateText(27, str(highscore))
-Nick Shepherd