n3ss3s
2007-05-15 05:03:21
Edit: dont come here go to the new thread my comp lagged like hell back then so it made 2 thrds.
I hope its first of its kind :D heres the deal:
It scans to the Direction given by the user(n,e,s,w) for the color given by the user until the distance from starting "line" has reached MaxDistance.
If you decide to scan to north or south, you create a horizontal line, for east and west you create a vertical line. I think it is complete, but it didnt work for me as supposed. Or then i just cant use my own function lol.
It should work.
( creating a line means u put 2 points :))
umm and it uses a support function i made "ColorOnLine"
When this becomes totally complete I think its worth the
Here :
I hope its first of its kind :D heres the deal:
It scans to the Direction given by the user(n,e,s,w) for the color given by the user until the distance from starting "line" has reached MaxDistance.
If you decide to scan to north or south, you create a horizontal line, for east and west you create a vertical line. I think it is complete, but it didnt work for me as supposed. Or then i just cant use my own function lol.
It should work.
( creating a line means u put 2 points :))
umm and it uses a support function i made "ColorOnLine"
When this becomes totally complete I think its worth the
SRL New Functions Post here anything worth implementing into SRL…
Here :
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;
// And heres the main function.//
function DirectionScanner(var cx, cy: integer; Direction: string;
MaxDistance, Lx, Ly, Lx2, Ly2, Color: integer): boolean;
{ Scripting Guru n3ss3s Brings You... DirectionScanner!.}
{ All info about the function : www.srl-forums.com}
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;