SRL Archive - SRL Archives

first of its kind..or i hope so....DirectionScanner


n3ss3s

2007-05-15 14:27:19

DirectionScanner

Usage
- Scans to the given direction for given color, until distance from start has reached "MaxDistance".
- Uses "ColorOnLine" function I made.
How To Use
In this function, you will create a line from 2 points.
(Lx,Ly,Lx2,Ly2)
The points must be on the same
- for North and South, Same horizontal coordinates
- for East and West, Same vertical coordinates.

The function got Scanner to its name because the scanning movement is same as using a scanner :D Groovy


It is not complete yet, It has some kind of problem with finding the color but Its possible I just cant use my function. Released because couldnt wait any longer lol.


function ColorOnLine(var ox, oy: integer; Dir: string; Color, Lx, Ly,
Lx2, Ly2: integer): boolean;
{ A support function for DirectionScanner.}
var A: integer;
begin
case Dir of
'n': begin
for A := Lx to Lx2 do
begin
if (GetColor(A, Ly) = Color) then
begin
MMouse(x, y, 0, 0);
GetMousePos(ox, oy);
result := true;
Break;
end;
end;
end;
'e': begin
for A := Ly to Ly2 do
begin
if (GetColor(A, Lx) = Color) then
begin
MMouse(x, y, 0, 0);
GetMousePos(ox, oy);
result := true;
Break;
end;
end;
end;
's': begin
for A := Lx to Lx2 do
begin
if (GetColor(A, Ly) = Color) then
begin
MMouse(x, y, 0, 0);
GetMousePos(ox, oy);
result := true;
Break;
end;
end;
end;
'w': begin
for A := Ly to Ly2 do
begin
if (GetColor(A, Lx) = Color) then
begin
MMouse(x, y, 0, 0);
GetMousePos(ox, oy);
result := true;
Break;
end;
end;
end;
end;
end;

function DirectionScanner(var cx, cy: integer; Direction: string;
MaxDistance, Lx, Ly, Lx2, Ly2, Color: integer): boolean;
{ DirectionScanner brought you by: n3ss3s}
{ All info about the function : http://www.villavu.com/forum/showthread.php?t=10160?p=112637#post112637}
var A: integer;
begin
case Direction of
'n': begin
for A := 1 to MaxDistance do
begin
if (ColorOnLine(x, y, 'n', Color, Lx, Ly, Lx2, Ly2)) then
begin
result := true;
MMouse(x, y, 0, 0);
GetMousePos(Cx, Cy);
Break;
end;
Ly := Ly - 1;
Ly2 := Ly2 - 1;
end;
end;
'e': begin
for A := 1 to MaxDistance do
begin
if (ColorOnLine(x, y, 'e', Color, Lx, Ly, Lx2, Ly2)) then
begin
result := true;
MMouse(x, y, 0, 0);
GetMousePos(Cx, Cy);
Break;
end;
Lx := Lx + 1;
Lx2 := Lx2 + 1;
end;
end;
's': begin
for A := 1 to MaxDistance do
begin
if (ColorOnLine(x, y, 's', Color, Lx, Ly, Lx2, Ly2)) then
begin
result := true;
MMouse(x, y, 0, 0);
GetMousePos(Cx, Cy);
Break;
end;
Ly := Ly + 1;
Ly2 := Ly2 + 1;
end;
end;
'w': begin
for A := 1 to MaxDistance do
begin
if (ColorOnLine(x, y, 'w', Color, Lx, Ly, Lx2, Ly2)) then
begin
result := true;
MMouse(x, y, 0, 0);
GetMousePos(Cx, Cy);
Break;
end;
Lx := Ly - 1;
Lx2 := Ly2 - 1;
end;
end;
end;
end;
Please post questions here and if someone has idea, about the problem or for improving, plz post.

When this function is complete, I think its totally worth
SRL New Functions Post here anything worth implementing into SRL…

Buckleyindahouse

2007-05-15 14:32:13

So its like walking but with color clicking?

n3ss3s

2007-05-16 01:08:38

np, its a color finding function.

omgh4x0rz

2007-05-16 14:13:20

Cool, GJ!

(why do we need another color finding function?)

n3ss3s

2007-05-16 17:23:42

because I was bored :) Naa it can be useful

rkroxpunk

2007-05-19 02:11:56

couldn't u just use Radialwalk or findcolor? soz I don't get it forgive my stupidity :D

n3ss3s

2007-05-19 04:19:22

Why does everyone think its a walking function? -.-
I hope someone comes and realizes lol :D

rkroxpunk

2007-05-19 06:36:14

well that's why I also said findcolor :P