Log in

View Full Version : I cant figure this out.



austin2162
05-11-2011, 10:41 PM
Im working on a timer for a progress report and i cant get it to add to mins.
here is my progress report code.

procedure proggy;
var
hr,mins,time,time1:integer;
begin
time:=getsystemtime - starttme
time1:=time/1000
if mins = 60 then
begin
mins:= 0
hr:= hr +1
end;
if time1 = 60 then
begin
starttme:= getsystemtime
mins:= mins +1
time1:= 0
end;


cleardebug;
writeln('-------------------------------------------------------------------------------------------------------------------------------------------------------');
writeln('|Estimated total xp = '+ inttostr(xptotal)+' xp. | Total estimated cash gain = '+inttostr(cshgain)+' g.|');
writeln('|Estimated total class xp = '+ inttostr(clstotal)+' xp.|');
writeln('|Total fights = '+inttostr(ftstotal)+'.|');
writeln('|Currently: '+gmstatus+'.|');
writeln('|Time running = '+inttostr(hr)+' hours, '+inttostr(mins)+' minutes, '+inttostr(time1)+' seconds.|');
writeln('|AdventureQuestWorlds fighter beta by austin2162 |');
writeln('-------------------------------------------------------------------------------------------------------------------------------------------------------');
end;

here is the issue though
hers the print out.
as you see one minute is added
-------------------------------------------------------------------------------------------------------------------------------------------------------
|Estimated total xp = 0 xp. | Total estimated cash gain = 0 g.|
|Estimated total class xp = 0 xp.|
|Total fights = 0.|
|Currently: Debuging.|
|Time running = 0 hours, 1 minutes, 0 seconds.|
|AdventureQuestWorlds fighter beta by austin2162 |
-------------------------------------------------------------------------------------------------------------------------------------------------------
this is the next report
-------------------------------------------------------------------------------------------------------------------------------------------------------
|Estimated total xp = 0 xp. | Total estimated cash gain = 0 g.|
|Estimated total class xp = 0 xp.|
|Total fights = 0.|
|Currently: Debuging.|
|Time running = 0 hours, 0 minutes, 1 seconds.|
|AdventureQuestWorlds fighter beta by austin2162 |
-------------------------------------------------------------------------------------------------------------------------------------------------------
any help?
edit: Im using simba

Zyt3x
05-11-2011, 10:43 PM
Instead of doing it manually, you could use the function MsToTime(MS, TheType: Integer): string;

like this: writeln('|Time running = ' + MsToTime(GetSystemTime - StartTime, Time_Formal) + '. |');

Would output (Example) "|Time running = 5 hours, 23 minutes and 26 seconds. |"

austin2162
05-11-2011, 10:45 PM
Thanks Zyt3x. Also thanks on the quick response.

Bixby Sayz
05-11-2011, 10:50 PM
You could try MsToTime(time, Time_Abbrev) to do the conversion/formatting for you. Outputs a string that looks something like this:


5 hr 13 min 2 sec

Edit: Damn, took too long to type/post.