SRL Archive - OSR Help

HOw to set counter to 0?


l6bustank

2012-11-17 07:00:31

Got this snippet of code:
repeat
Wait(RandomRange(87, 111));
Inc(Count);
If (Count > 50) then
begin
Writeln('Count more than 50!');
Exit;
end;
until (InvCount < 15);
Now, after InvCount falls below 15 and the loop ends, I need to set variable "Count" to 0. How can I do it?

riwu

2012-11-17 07:06:10

Count:= 0;
Note that if declared locally, it will be set to 0 automatically upon entry/exit to the local procedure.
Also might be better to use a timer breaker instead in cases like this.

The Killer

2012-11-17 07:06:27

Count := 0 might work
edit: :ninja:'d

weequ

2012-11-17 07:12:17

And Inc(Count) is basically same as Count := Count + 1;

l6bustank

2012-11-17 07:13:33

Used Count := 0 , script is working fine now :D

btw, whats a timer breaker?

riwu

2012-11-17 07:27:56

Comparing the current SystemTime with the SystemTime stored before the loop. Read some beginners tutorial on that.