I'll put my finished code here for anyone that wants to see. I used GetDebugText and copied the report from the debug box because it includes spaces and so when I write the part of it I need to the file it turns out fine.
SCAR Code:
//In Setup
s := '';
if FileExists(ScriptPath + 'Forest Frostbite Report.txt') then
Begin
Fr0znFile := OpenFile(ScriptPath + 'Forest Frostbite Report.txt', false);
ReadFileString(Fr0znFile, s, FileSize(Fr0znFile));
CloseFile(Fr0znFile);
end;
Fr0znFile := RewriteFile(ScriptPath + 'Forest Frostbite Report.txt', false);
if s <> '' then
WriteFileString(Fr0znFile, s);
WriteFileString(Fr0znFile, TheDate(1) + ', ' + TheTime + ' ');
CloseFile(Fr0znFile);
//In ProgressReport
Fr0znFile := OpenFile(ScriptPath + 'Forest Frostbite Report.txt', false);
ReadFileString(Fr0znFile, s, FileSize(Fr0znFile));
CloseFile(Fr0znFile);
Fr0znFile := RewriteFile(ScriptPath + 'Forest Frostbite Report.txt', false);
Delete(s, LastPos(TheDate(1), s) + Length(TheDate(1)) + Length(TheTime) + 3, Length(s));
DebugText := GetDebugText;
DebugText := Copy(DebugText, LastPos('<> <* Forest', DebugText) - 55, Length(DebugText));
Insert(DebugText, s, Length(s));
WriteFileString(Fr0znFile, s);
CloseFile(Fr0znFile);
Steps script undergoes:
(In Setup)
1. If file exists then opens it and copies progress reports from previous sessions.
2. Creates the file, opening it for editing and pasting in the old progress reports if there were any. Writes todays date and time at start of session.
(In Report)
3. Stores text of file in variable 's'
4. Deletes all text after todays date (erases the progress report from last load)
5. Gets the text in debug box.
6. Copies the newest report from debug box to variable 'debug'
7. Inserts the text from 'debug' into the end of 's'
8. Writes 's' to file. S will contain previous sessions reports and also the newest one from the current session.
Hope that will help anyone else having problems!