Ok i found the problem, it is in the file. If the file doesn't exist yet, then add use this.
SCAR Code:
program SaveTimerToFile;
var
MyTotalTimer,a: integer;
TimeFromLast: string;
Procedure SaveCurrentTime;
begin
WriteIni('Timer','TimeFromLast',IntToStr(MyTotalTimer),'.\TimeIni.ini';
TimeFromLast:= ReadIni('Timer','TimeFromLast','.\TimeIni.ini');
MyTotalTimer:= GetTimeRunning + StrToInt(TimeFromLast);
WriteIni('Timer','TimeFromLast',IntToStr(MyTotalTimer),'.\TimeIni.ini');
end;
Procedure TotalTime;
begin
Writeln('Has run for: ' + IntToStr(MyTotalTimer) + ' Miliseconds');
end;
begin
SaveCurrentTime;
TotalTime;
end.
It has to make the file first before it can get data from it, so make sure it has something to make the file first.
Something like this (took out of first box):
SCAR Code:
WriteIni('Timer','TimeFromLast',IntToStr(MyTotalTimer),'.\TimeIni.ini';
As this will create the file the first time.
I hope this is helpfull to all of you too. I learnt from it, maybe you can too.