SRL Archive - Help

How to shorter and make it better


fearlesskiller

2012-01-19 20:37:43

So this is a part of my pest control script where it should attack the npcs teleporting to void knight. The only problem is that i dont know how to make it shorter, better and how to make it that its when it sees 1 of those 4 color.

procedure AttackNpc;
var x, y:integer;
begin
FindColorTolerance(x, y, 1327672, MSX1, MSY1, MSX2, MMY2, 3)
if FindColorTolerance(x, y, 1327672, MSX1, MSY1, MSX2, MMY2, 3) then
Mouse(x, y, 2, 2, True);
wait(3000+random(75));
FindColorTolerance(x, y, 2902160, MSX1, MSY1, MSX2, MSY2, 3)
if FindColorTolerance(x, y, 2902160, MMX1, MSY1, MSX2, MSY2, 3) then
Mouse(x, y, 2, 2, True);
wait(3000+random(75));
FindColorTolerance(x, y, 792070, MSX1, MSY1, MSX2, MSY2, 3)
if FindColorTolerance(x, y, 792070, MSX1, MSY1, MSX2, MSY2, 3) then
Mouse(x, y, 2, 2, True);
wait(3000+random(75));
FindColorTolerance(x, y, 3935042, MSX1, MSY1, MSX2, MSY2, 3)
if FindColorTolerance(x, y, 3935042, MSX1, MSY1, MSX2, MSY2, 3) then
Mouse(x, y, 2, 2, True);
wait(3000+random(75));
end;

bg5

2012-01-19 21:03:06


var
Colors: TIntegerArray;
b ,x,y: integer;
Found : Boolean;

begin

colors := [3432432,432432423,4234242] ; // all colors you want

for b := 0 to (High(colors)) do
begin
if (FindColorTolerance(x, y, colors[b], xs, ys, xe, ye, Tol)) then
begin
Found := True;
Break;
end;
end;

if (found) then
begin
{ ... }
end;

end;

fearlesskiller

2012-01-19 21:06:14

Do i need to change anything in that cause its not working. Maybe you should specify please

[XoL]

2012-01-19 21:09:16


if (found) then
begin
{ ... }
end;

end;

Put the procedure you want to happen in there.

Dynamite

2012-01-19 21:10:44

From: fearlesskiller
Do i need to change anything in that cause its not working. Maybe you should specify please


On an even bigger plate for you:

procedure FindAndClickColors;
var
colors: TIntegerArray;
b ,x, y: integer;

begin

colors := [1327672, 2902160, 792070, 3935042] ; // all colors you want

for b := 0 to (High(colors)) do
begin
if (FindColorTolerance(x, y, colors[b], xs, ys, xe, ye, Tol)) then
begin
Mouse(x, y, 2, 2, True);
wait(3000+random(75));
Break;
end;
end;

end;

-Boom

fearlesskiller

2012-01-19 21:11:35

I did put
Mouse(x, y, 2, 2, true);

but i get that error
[Error] (73:45): Unknown identifier 'xs' at line 72
which is in
if (FindColorTolerance(x, y, colors, xs, ys, xe, ye, Tol)) then

kevin33

2012-01-19 21:13:25

From: fearlesskiller
I did put
but i get that error
[Error] (73:45): Unknown identifier 'xs' at line 72
which is in


xs needs to be defined in variables. I would figure it would be:

xs: integer;
THEN again you may need to fill in your own info there. Not familiar with the FindColorTolerance.

Dynamite

2012-01-19 21:19:15

Use MS co-ordinates like you did.

-Boom

bg5

2012-01-19 21:30:56

procedure FindAndClickColors;
var
colors: TIntegerArray;
b ,x, y: integer;

begin

colors := [1327672, 2902160, 792070, 3935042] ; // all colors you want

for b := 0 to (High(colors)) do
begin
if (FindColorTolerance(x, y, colors[b], MSX1, MSY1, MSX2, MMY2, 3)) then
begin
Mouse(x, y, 2, 2, True);
wait(3000+random(75));
Break;
end;
end;

end;

fearlesskiller

2012-01-20 07:47:23

Thanks guys i really appreciate it!