У меня есть система рекордов, которая просит вас ввести свое имя, и она сохранит ваш счет в текстовом файле.Этот текстовый файл будет снова открыт при нажатии кнопки оценки, показывая все высокие оценки.Прямо сейчас, когда кнопка партитуры нажата, она отвечает только пустым окном.Файл Scores.txt содержит все сохраненные результаты.Вот текст для кнопки оценки:
on mouseUp
put specialFolderPath("documents") & "/Scores.txt" into myFile
set itemDelimiter to tab
put url ("file:" & myFile) into x
sort lines of x numeric descending by item 2 of each
answer x
end mouseUp
Вот код, который сохраняет результаты в Scores.txt:
on stopGame
put false into gameisRunning
set the bottom of btn "bird" to 225
set the angle of image "Bird" of stack "graphics" to 0
ask "What is your name?"
if it is not empty then
put it into theName
put specialFolderPath("Documents") & "Scores.txt" into myFile
put URL("file:" & myFile) into highScores
put theName & tab & field "score" & return after highScores
put highScores into URL ( "File:" & myFile)
end if
end stopGame