troller Posted October 12, 2014 Share Posted October 12, 2014 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 Quote Link to comment Share on other sites More sharing options...
Neron Posted October 13, 2014 Share Posted October 13, 2014 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 Quote Link to comment Share on other sites More sharing options...
troller Posted October 16, 2014 Author Share Posted October 16, 2014 thanks a lot dude! However, the script is written in scar 3.22 and TPAFilterPoints is not recognized. Is there any command with the same effect in scar 3.22 And again thanks for your answer Quote Link to comment Share on other sites More sharing options...
Wanted Posted October 16, 2014 Share Posted October 16, 2014 CTRL + Shift Look for ExtractTPA or TPAExtract I think Quote Link to comment Share on other sites More sharing options...
troller Posted October 16, 2014 Author Share Posted October 16, 2014 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 Quote Link to comment Share on other sites More sharing options...
Neron Posted October 16, 2014 Share Posted October 16, 2014 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 Quote Link to comment Share on other sites More sharing options...
troller Posted October 17, 2014 Author Share Posted October 17, 2014 Thank you for your answer. However im not able to understand the use of mask(scar wiki has no reference to it) Where do it type the word that i want to be searched? or it works different that that? Thanks Quote Link to comment Share on other sites More sharing options...
Neron Posted October 18, 2014 Share Posted October 18, 2014 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. <-- sample mask for finding letter A in any color on any background. Quote Link to comment Share on other sites More sharing options...
troller Posted October 21, 2014 Author Share Posted October 21, 2014 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 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!!! Quote Link to comment Share on other sites More sharing options...
Neron Posted October 24, 2014 Share Posted October 24, 2014 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 Quote Link to comment Share on other sites More sharing options...
troller Posted October 24, 2014 Author Share Posted October 24, 2014 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 Quote Link to comment Share on other sites More sharing options...
Janilabo Posted October 24, 2014 Share Posted October 24, 2014 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. Quote Link to comment Share on other sites More sharing options...
troller Posted October 26, 2014 Author Share Posted October 26, 2014 (edited) 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 October 27, 2014 by troller Quote Link to comment Share on other sites More sharing options...
troller Posted October 31, 2014 Author Share Posted October 31, 2014 Someone? Quote Link to comment Share on other sites More sharing options...