SRL Archive - General Botting Help

Timing Procedure?


351bryce

2014-02-18 01:25:28

How would i go about making a timing function stop watch that that will in a procedure (check the time) and if it higher then a minute or so activate a procedure and restart the timer?

Frement

2014-02-18 01:32:52

program new;

const timetowait = 1000;

var counter: integer;

procedure Test;
begin
Writeln('Test');
end;

begin
counter := getsystemtime;
repeat
while ((getsystemtime - counter) > timetowait) do begin
Test;
counter := getsystemtime;
end;
until(false);
end.

The Mayor

2014-02-18 01:55:47

Also, if you are using SRL6, you could always use the TTimeMarker type:


program new;
{$DEFINE SMART}
{$I SRL-6/SRL.simba}


procedure afterOneMinute();
begin
writeLn('Running the afterOneMinute() procedure');
end;

procedure waitForOneMinute();
var
stopWatch: TTimeMarker; // declaring 'stopWatch' as a TTImeMarker

begin
stopWatch.start(); // start the timer

repeat

if stopWatch.getTime() > 60000 then // if timer running > 60 sec
begin
afterOneMinute();
stopWatch.reset(); // reset the timer back to 0 ms
stopWatch.start(); // start it again
end;

writeLn('Stopwatch has been running for: ' + toStr(stopWatch.getTime()));

until(false);

end;

begin
setupSRL();
waitForOneMinute();
end.

351bryce

2014-02-18 02:06:03

From: Frement
program new;

const timetowait = 1000;

var counter: integer;

procedure Test;
begin
Writeln('Test');
end;

begin
counter := getsystemtime;
repeat
while ((getsystemtime - counter) > timetowait) do begin
Test;
counter := getsystemtime;
end;
until(false);
end.


Tyvn This Is very helpfull just what i was looking for.