Jump to content
troller

Blacklisting pixels

Recommended Posts

hey there,

I've been messing around with scar for quite long and i became pretty efficient with it.

However i could not find something like blacklisting pixels.

Example

Find a color in a place, click it and then blacklist(or ignore) the pixel for some seconds

Is something like this possible?

Thanks in advance

Link to comment
Share on other sites

hi!

 

var 
blacklist,FoundPoints : TPointArray;
x1,y1,x2,y2,tol,color: integer;
begin
x1 :=0;
y1 :=100;
x2 :=101;
y2 :=101;  
color := clwhite;
tol := 0;

FindColorTolEx(FoundPoints,color,x1,y1,x2,y2,tol); // finding all points of some color...

writeln('first white at: '+PointToStr(FoundPoints[0]));

if (high(FoundPoints)> -1)then TPAAppend(blacklist, FoundPoints[0]);  // adding first found point to blacklist

TPAFilterPoints(FoundPoints,BlackList); // filtering (ignore what is in blacklist)

writeln('first white at: '+PointToStr(FoundPoints[0]));

blacklist := []; //this resets blacklist;
end.

also you can use : procedure TPAFilterBoxes(var TPA: TPointArray; const Boxes: TBoxArray);

http://wiki.scar-divi.com/TPAFilterBoxes

Link to comment
Share on other sites

TpaExtract is also for scar 3.28 or greater.

Same problem for TpaAppend too.

Never mind, i may make changes in order to get it to work in latest scar.

 

However, i have 2 random questions.

1)How is the command GetClientDimensions from scar 3,22 in scar 3,40

2)Is it possible any search for characters(e.g. letters) in scar?

Thanks in advance

Link to comment
Share on other sites

TpaExtract is also for scar 3.28 or greater.

Same problem for TpaAppend too.

Never mind, i may make changes in order to get it to work in latest scar.

 

However, i have 2 random questions.

1)How is the command GetClientDimensions from scar 3,22 in scar 3,40

2)Is it possible any search for characters(e.g. letters) in scar?

Thanks in advance

1)

var mybox:Tbox;

begin

mybox:=getclient.ImageArea;

and for search characters use mask:

 

2)FindBitmapMaskTolerance(mask,x,y,bx.X1,bx.Y1,bx.X2,bx.Y2,tol,tol2);

hope will help

Link to comment
Share on other sites

this is from old manual:

function FindBitmapMaskTolerance(bmp: TscarBitmap; var x, y: Longint; x1, y1, x2, y2: Longint; Tolerance, ContourTolerance: Integer): Boolean;

Essentially it works like FindBitmapIn except it identifies using the masks/shape of an object in the bitmap. Masks are specified by the colors black and white. ContourTolerance is the minimal tolerance for color difference between shape of a mask and the background in a bitmap, It makes sure the shape differs from the background.

a.png<-- sample mask for finding letter A in any color on any background.

Link to comment
Share on other sites

Hmmm yes but i need to search for a whole word in which letters are moving and are not stick to each other, so there's no shape of the mask because i have many letters(Is it like that). Also the background color in not one but many so ???? now what.

But its ok, i can use this command in an other part of the script :D:D

 

I have a final question. Im using FindColorsSpiralTolerance command. My question is, how can i click the 2nd or 3rd.... or 50th found point? Can you guide me, im lost, i read the manual but i cant seem to find anything about stored coordinates of the other instances found. Im not pretty efficient with tpoint arrays and how they work. Please Help!

Thanks A LOt!!!

Link to comment
Share on other sites

hello! for mask you put whole word, and background color is not important, anyway i shoud see, then i can tell

 

for spiral multifindings you can use

var Found : Tpointarray;
begin

if FindColorSpiralTolEx(100,100,Found,clwhite,50,50,100,100,10) then 
 begin
 writeln('found '+inttostr(max+1)+' points!')
 writeln(PointToStr(found[0])); // first
 writeln(PointToStr(found[1])); // second
 writeln(PointToStr(found[49])); // 50th
 writeln(TPAToStr(found)); // all foundings
 end;

end.

 

but, if you call higher found then exist you will get "out of range" error

Link to comment
Share on other sites

Thanks for the mask explanation. I figured it out.

However i dont seem to understand the multifinding items thing. I mean, how can i click the first, then the second, and so on? Also the color im searching appears in different number of instances each time(maybe none, 1 or even 15), so as i understood, i will get an "out of range" error

And remember the script is made for scar 3.22 and PointToStr and TpaToStr are not recognized(however, i want just click, not writeln)

thanks

Link to comment
Share on other sites

Thanks for the mask explanation. I figured it out.

However i dont seem to understand the multifinding items thing. I mean, how can i click the first, then the second, and so on? Also the color im searching appears in different number of instances each time(maybe none, 1 or even 15), so as i understood, i will get an "out of range" error

And remember the script is made for scar 3.22 and PointToStr and TpaToStr are not recognized(however, i want just click, not writeln)

thanks

You simply use the X and Y variables of the TPoint record, like so:

 

var
 found: TPointArray;
 h, i: Integer;

begin
 if FindColorSpiralTolEx(100, 100, found, clWhite, 50, 50, 100, 100, 10) then
 begin
   h := High(found);
   WriteLn('Found ' + IntToStr(h + 1) + ' points!')
   for i := 0 to h do
     MoveMouse(found[i].X, found[i].Y); // Replace with your clicking method, whatever it is.
   MoveMouse(found[0].X, found[0].Y); // Index example, without loop.
 end;
end.

Link to comment
Share on other sites

Thanks a lot!!!

I understood everything but i still have a remaining problem.

Have a look at this


var x, y : integer;
found : TpointArray;

begin
If FindColor(x, y, 50567, 500, 450, 700, 575) then /////Find Player////
begin
If FindColorsSpiralTolerance(x, y, found, 0, 500, 450, 700, 575, 5) then ////Find bot according to player's position(find the closest one)///
begin
writeln('Bot Found');
end else
Writeln('Bot Not Found');
end;
end.
[/Code]

Even though player is successfully found and Bot's color is visible, i always get, bot not found.

What is the problem? When i use FindColorsTolerance, bot's color is successfully found.

Please help, when i fix this, script is ready for use

Edited by troller
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...