SRL Archive - SRL Archives

procedure DirectionWalk


Infantry001

2007-04-09 21:02:20

{*******************************************************************************
procedure DirectionWalk(dir : string; radius, FFlagbreak : integer);
By: Infantry001
Description: Walks in a direction specified by user. Arguments for dir are - 'n',
'ne','e','se', etc. Radius is how far out to walk, and FFlagbreak is how far you
are from flag before exiting the procedure.
*******************************************************************************}
function RandomBetween(Number1,Number2 : integer) : integer;
var
i : integer;
begin
i := Round(Abs(Number1 - Number2)) + 1;
if Number1 < Number2 then
result := Number1 + Random(i)
else
result := Number1 - Random(i);
end;

procedure DirectionWalk(dir : string; radius, FFlagbreak : integer);
var
iX,iY : integer;
Tradius,rad1,rad2,FRad : integer;
begin
TRadius := radius + random(6) - random(6);
Case Lowercase(dir) of
'n' : begin
Rad1 := 340;
Rad2 := 380;
end;
'ne' : begin
Rad1 := 25;
Rad2 := 65;
end;
'e' : begin
Rad1 := 70;
Rad2 := 110;
end;
'se' : begin
Rad1 := 115;
Rad2 := 155;
end;
's' : begin
Rad1 := 160;
Rad2 := 200;
end;
'sw' : begin
Rad1 := 205;
Rad2 := 245;
end;
'w' : begin
Rad1 := 250;
Rad2 := 290;
end;
'nw' : begin
Rad1 := 295;
Rad2 := 335;
end;
end;
FRad := RandomBetween(Rad1,Rad2);
iX := Round(TRadius * Sine(FRad)) + 646;
iY := Round(-TRadius * Cose(FRad)) + 84;
Mouse(iX,iY,5,5,true);
FFlag(FFlagBreak);
end;

Walks in a specified direction. Useful if you are trapped in an area without a roadcolor (i.e. Varrock West Mines or Al-Kharid)

Ejjman

2007-04-09 21:29:32

Phew, this procedure is HAWT :sasmokin:


I might be using this ;)

Infantry001

2007-04-09 22:31:48

thanks, Ejjman! i appreciate a comment :P

TheGodfather

2007-04-09 23:17:46

looks very useful in the way specified :o

Great Function :)

edit: but oddly enought there looks liek thers two different function up there :S

EDIT: hah nvm they're useful for eachother hahaha

Bobarkinator

2007-04-11 18:33:58

I'm gonna test it out. Hope it works great.

Infantry001

2007-04-12 17:55:56

thanks guys. i think you could substitute RandomBetween for RandomRange (in DIVI)

SKy Scripter

2007-04-18 02:55:15

muhahha!!!!! i have one that works a lot better that i made :D
not going to post it though :p it will be in my next script i hope..
great Job Though !

WhiteShadow

2007-04-18 18:58:03

function RandomBetween(Number1,Number2 : integer) : integer;
var
i : integer;
begin
i := Round(Abs(Number1 - Number2)) + 1;
if Number1 < Number2 then
result := Number1 + Random(i)
else
result := Number1 - Random(i);
end;

Question, why do you use Round? You seem to be only using Integer values.. sorry if I'm missing something.

Back to your function though. I think it rocks.. ! ;P

Infantry001

2007-04-18 21:49:06

Abs() results in an extended variable ;)

WhiteShadow

2007-04-18 23:58:21

From: Infintry001
Abs() results in an extended variable ;)


I knew I was missing something, I rarely use math functions in scar. Thanks ! I'll keep that in mind. :}

Johura

2007-04-22 09:46:49

Thanks i needed this :)