SRL Archive - SRL Archives

function RadialLineWalk


Markus

2007-05-15 10:35:58

I created this function as a combination of Linearwalk and Radialwalk.
Walks from middle out of the radial within maxrange until a certain color is found. If the specified color is not found it will lower the radius and look again.

{*******************************************************************************
function RadialLineWalk(TheColor, radial, maxrange, radius, xmod, ymod : integer) : boolean;
By: Markus, based on Linearwalk and Radial walk by WT-Fakawi and Wizzup
Description: Walks from middle out of the radial within maxrange until a certain color is found.
If the specified color is not found it will lower the radius and look again.
*******************************************************************************}
function RadialLineWalk(TheColor, radial, maxrange, radius, xmod, ymod : integer) : boolean;
var count, x1, y1, initradial : integer;
begin
initradial := radial;
repeat
for count := 0 to maxrange do
begin
radial := radial + count;
x1 := Round(Radius * Sin(radial * pi / 180)) + mmcx;
y1 := Round(-Radius * Cos(radial * pi / 180)) + mmcy;
if GetColor(x1, y1) = TheColor then
begin
MouseFindFlag(x1, y1, Xmod, Ymod);
result := true;
exit;
end;
radial := radial - count;
x1 := Round(Radius * Sin(radial * pi / 180)) + mmcx;
y1 := Round(-Radius * Cos(radial * pi / 180)) + mmcy;
if GetColor(x1, y1) = TheColor then
begin
MouseFindFlag(x1, y1, Xmod, Ymod);
result := true;
exit;
end;
end;
radius := radius - 4;
until(radius < 4);
end;

Demonstration script, use this in paint and it will draw the way of colorfinding.
DONT USE THIS IN RUNESCAPE!

program RLDemo;

procedure RadialLineWalk2(radial, maxrange, radius, xmod, ymod : integer);
var count, x1, y1, initradial : integer;
begin
initradial := radial;
repeat
for count := 0 to maxrange do
begin
radial := initradial + count;
x1 := Round(Radius * Sin(radial * pi / 180)) + mmcx;
y1 := Round(-Radius * Cos(radial * pi / 180)) + mmcy;
// writeln('x1 : ' + inttostr(x1) + ' y1 : ' + inttostr(y1));
MoveMouse(x1, y1);
ClickMouse(x1, y1, true);
wait(10);
radial := initradial - count;
x1 := Round(Radius * Sin(radial * pi / 180)) + mmcx;
y1 := Round(-Radius * Cos(radial * pi / 180)) + mmcy;
// writeln('x1 : ' + inttostr(x1) + ' y1 : ' + inttostr(y1));
MoveMouse(x1, y1);
ClickMouse(x1, y1, true);
wait(10);
end;
radius := radius - 4;
until(radius < 4);
end;

begin
RadialLineWalk2(340, 20, 70, 1, 1);
RadialLineWalk2(20, 10, 30, 1, 1);
RadialLineWalk2(180, 40, 65, 1, 1);
end.

Please tell me what you think of it.
Markus

Buckleyindahouse

2007-05-15 14:33:37

Your using ClickMouse and MoveMouse in the demo. Remove and replace with srl functions.

Markus

2007-05-15 14:42:31

From: Buckleyindahouse
Your using ClickMouse and MoveMouse in the demo. Remove and replace with srl functions.


It's a demo, use it in Microsoft paint, and it will show how it looks for the color.

Buckleyindahouse

2007-05-15 14:54:04

OOOooooh, lol i feel dumb lol.

Wanted

2007-05-15 16:52:58

You should use this

x1 := Round(Radius * Sin((Pi/180)* FixD(rs_GetCompassAngleDegrees + Radial)) + MMCX);
y1 := Round(-Radius * Cos((Pi/180)* FixD(rs_GetCompassAngleDegrees + Radial)) + MMCY);

instead of this

   x1 := Round(Radius * Sin(radial * pi / 180)) + mmcx;
y1 := Round(-Radius * Cos(radial * pi / 180)) + mmcy;

That way screwy compass angles can't mess you up.;)

I ran your test in Paint, it's very interesting. I'd like to see it implemented in one of your/other people's future scripts. :)

Markus

2007-05-15 21:30:04

Thank you.
And I created this for the FCMB, deathwalk to Draynor, and a private script. It's usefull for long distances.

Wanted

2007-05-15 23:29:21

Open paint and put it on the large spray can, run this.
Draws crazy pictures.
program RLDemo;

procedure RadialLineWalk2(radial, maxrange, radius, xmod, ymod : integer);
var count, x1, y1, initradial,stuff : integer;
begin
initradial := radial;
repeat
for count := 0 to maxrange do
begin
radial := initradial + count;
x1 := Round(Radius * Sin(radial * pi / 180)) + mmcx;
y1 := Round(-Radius * Cos(radial * pi / 180)) + mmcy;
writeln('x1 : ' + inttostr(x1) + ' y1 : ' + inttostr(y1));
ClickMouse(x1, y1, true);
radial := initradial - count;
x1 := Round(Radius * Sin(radial * pi / 180)) + mmcx;
y1 := Round(-Radius * Cos(radial * pi / 180)) + mmcy;
writeln('x1 : ' + inttostr(x1) + ' y1 : ' + inttostr(y1));
ClickMouse(x1, y1, true);
stuff := random(5);
case stuff of
0: ClickMouse(14, 480, true);
1: ClickMouse(77, 480, true);
2: ClickMouse(61, 480, true);
3: ClickMouse(46, 480, true);
4: ClickMouse(45, 464, true);
5: ClickMouse(29, 481, true);
end;
end;
radius := radius - 4;
until(radius < 4);
end;

begin
RadialLineWalk2(1, 360, 70, 1, 1);
end.

Markus

2007-05-16 14:51:07

Lol, it created a nice picture.
If you want to see a example of this one implemented, my aircrafter 2.0 has it.