Jump to content
spartakos

Tolerance with more colors??

Recommended Posts

Hallo guys.I need some help here. I'm trying to make a script that can recognise many colors and when it does to press space. Untill now I made that which works just fine but I don't know how to add more colors:

 

Program FindColorClickColor;

 

Const

Color = 7167576; // color you wish to click

 

Procedure FindClick;

Var

X,Y,W,H: Integer;

begin

GetClientDimensions(W,H);

If FindColorTolerance(X,Y,7167576,81, 170, 1250, 845, 4) then

Begin

MoveWindMouse(X,Y,81, 170);

ClickMouse(X,Y,True);

SendKeys(chr(32));

end;

end;

 

begin

Repeat // Repeats for ever.. or until program is stopped.

FindClick;

Wait(150);

ClickMouseBox(81, 170,1250, 845, True);

Until False;

end.

 

 

Then I tried to use the MaxColor but it wasn't effective att all. It doesn't find anythin at all...

 

Program FindColorClickColor;

 

Const

MaxColors = 3;

Var

Colors: Array[0..MaxColors] of Integer;

 

Procedure DeclareColors;

begin

Colors[0] := 2570874;

Colors[1] := 7167576;

Colors[2] := 786687;

 

end;

 

Procedure FindClick;

Var

X,Y,W,H: Integer;

begin

GetClientDimensions(W,H);

If FindColorTolerance(X,Y,MaxColors,81, 170, 1250, 845, 4) then

Begin

MoveWindMouse(X,Y,81,170);

ClickMouse(X,Y,True);

SendKeys(chr(32));

end;

end;

 

begin

Repeat // Repeats for ever.. or until program is stopped.

FindClick;

Wait(150);

ClickMouseBox(81, 170,1250, 845, True);

Until False;

end.

 

 

 

Am I doing something wrong? It seems that the one with Tolerance works better but is it possible to add more colors? Do you have anything else to suggest?

Link to comment
Share on other sites

I thought that there I put the number of the colors I'm looking for, and below I name the colors one by one... It doesn't work that way?

 

- - - Updated - - -

 

Hey man, thank you. I just download it but I cannot figure out how to insert the colors I want. I can't find the manual either.

Link to comment
Share on other sites

I thought that there I put the number of the colors I'm looking for, and below I name the colors one by one... It doesn't work that way?

 

- - - Updated - - -

 

Hey man, thank you. I just download it but I cannot figure out how to insert the colors I want. I can't find the manual either.

 

SCAR 3.4:

const
 MaxColors = 3; 

var
 Colors: Array[0..MaxColors] of Integer;

procedure DeclareColors;
begin
 Colors[0] := 2570874;
 Colors[1] := 7167576;
 Colors[2] := 786687;
end;

var 
 Pt: TPoint;
begin
 if FindColorsTol(Pt.x, Pt.y, Colors, 81,170,1250,845, 4) then
 begin
   WriteLn(PointToStr(Pt));
   MoveMouse(pt.x,pt.y);
 end;
end.

 

FindColors - SCAR Divi Manual

 

 

if you need a list of all the points on your screen containing the given colors you can use FindColorsTolEx.

const
 MaxColors = 3; 

var
 Colors: Array[0..MaxColors] of Integer;

procedure DeclareColors;
begin
 Colors[0] := 2570874;
 Colors[1] := 7167576;
 Colors[2] := 786687;
end;

var 
 TPA: TPointArray; //list of coordinates
 Pt:TPoint;
begin
 if FindColorsTolEx(TPA, Colors, 81,170,1250,845, 4) then
 begin
   WriteLn('Found ' + IntToStr(Length(TPA)) +' points containing given colors!');
   Pt := TPA[0];
   WriteLn('First found:'+ PointToStr(Pt));
   MoveMouse(Pt.x, Pt.y);
 end;
end.

Edited by slacky
Link to comment
Share on other sites

Hi Slacky. Happy New Year. Thank you very much for your response. I tried the way you recommended but it seemed to be less effective than the FindColorTol in the 3.22 Version, even I used the same color-codes. So I prefared to repeat the command as many times I need it...

 

Do you know any way to exclude some points that have similar colors? Thats my main problem right now.. It keeps clicking in spots I don't want... Those spots are not stable in the screen.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
  • Create New...