SRL Archive - OSR Help

Keeping time?


RISK

2010-02-25 19:03:54

So I was wondering if there was a proper way to track how long a procedure has been active? I need it because the monsters in a certain area (Rock Crabs) do not become aggro'd to you after 10 minutes or so. So you need to leave the area far enough to reaggro them to you.

Any way to do it properly and efficiently?

Thanks!

NCDS

2010-02-25 19:06:15


procedure Timing;
var
t: Integer;
begin
MarkTime(t); // Starts timing here.
Wait(RandomRange(1000, 2000));
if TimeFromMark(t) > 1500 then // Checks if the time since 'MarkTime(t)'
Writeln('Over')
else
Writeln('Under');
end;

So in your MainLoop have it constantly loop through and when it has been 10 minutes use the RunAway functions. I believe they are in Walking.scar.

Blumblebee

2010-02-25 19:08:25

marktime(var time: integer);

timefrommark(time: integer);

or alternatively getSystemTime(); which is basically the same thing.

ex.

procedure blah;
var
timer: integer;
begin
marktime(timer);
shithere;
writeLn('took: '+IntToStr(timeFromMark(timer)));
end;

I haven't used marktime in forever, but im pretty sure that's how it works ;)

RISK

2010-02-25 19:11:37

Thanks you two. I was curious on how to do this.

Appreciate the help!

Blumblebee

2010-02-25 19:18:18

From: Risk
Thanks you two. I was curious on how to do this.

Appreciate the help!


your welcome. and for the record, I'm smarter than NCDS, so regardless what he tells you, I'm more right.

NCDS

2010-02-25 19:25:43

From: Blumblebee
your welcome. and for the record, I'm smarter than NCDS, so regardless what he tells you, I'm more right.


Can't argue with fact :/