SRL Archive - OSR Help

Calling a procedure that calls that procedure?


Troll

2011-08-08 04:02:48

Ok so i have a wait procedure which does anti ban and calls find randoms while waiting but in my antiban i want a min or two wait and for this wait i want to call the wait procedure i have made to check for randoms and anti. So my question is do i need to make two wait procedures or is there way to be able to call something below you in the code? So if it does not make much sense but basicly


procedure AntiBan;
Begin
TrollWait;
End;

Procedure TrollWait;
Begin
AntiBan;
End;



Something like that, but of cousre it has more code in it ;)

Thanks for any help :D

~Troll

Flight

2011-08-08 04:11:41

I'm a bit confuzzled. :S In your Anti-ban, you also want to be checking for randoms, yes?

How about something like this?:


Procedure AntiBan;
var
i: Integer;
begin
if not LoggedIn then Exit;
R_FindRandoms;
i := Random(250);

case i of
1..10: RandomAngle(1);
11: Hoverskill('Farming',False);
12: RandomMovement;
end;

Wait(RandomRange(100,250));
end;

So as long as 'AntiBan' is being called, it will randomly pick a number between 1 and 250 every 100-250 milliseconds. If that number is between 1-12, it will do one of those anti-bans, but from 13-250 (obviously checked more often) it will search for Randoms and if you're player is logged in.

Hopefully that answers your question.

Shuttleu

2011-08-08 04:21:38

you use forward


Procedure TrollWait; forward;

procedure AntiBan;
Begin
TrollWait;
End;

Procedure TrollWait;
Begin
AntiBan;
End;

TomTuff

2011-08-08 04:23:20


program new;


procedure B; forward;


procedure A;
begin
writeln('A');
B;
end;


procedure B;
begin
writeln('B');
A;
end;


begin
A;
end.
Run it and see what it does ;)

Troll

2011-08-08 04:34:31

Thanks for the help every one :)

From: TomTuff

program new;


procedure B; forward;


procedure A;
begin
writeln('A');
B;
end;


procedure B;
begin
writeln('B');
A;
end;


begin
A;
end.
Run it and see what it does ;)


Thanks for pointing the end less loop out :) I would of missed it for a while as they way i called it the only time it would go into that loop would be 1 in 500. Thanks again everyone

Nava2

2011-08-08 08:06:26

That is called recursion in a less elegant way! :)