seafight17 Posted December 27, 2012 Share Posted December 27, 2012 (edited) Hallo and merry christmas I wonder if it pocible in scar divi after finding a "mask" in the specific cordinates to check the colour if it is yellow or red or enother colour(there are specific colour so i no need the tolerance)..ex> [scar] procedure maskcolour; begin If FindBitmapMaskTolerance(Mask1, x, y, skx1, sky1, skx2, sky2, masktol, maskisetol) then begin //mask in the specific search area // and here any action that can deteck the colour the the mask end; end; [/scar] thank you Edited December 27, 2012 by seafight17 Quote Link to comment Share on other sites More sharing options...
Janilabo Posted December 27, 2012 Share Posted December 27, 2012 Not exactly sure what you are trying to do.. Can you give us some picture examples? Would be easier to help you out! -Jani Quote Link to comment Share on other sites More sharing options...
seafight17 Posted December 27, 2012 Author Share Posted December 27, 2012 ok .I have a mask (bitmap) ..the sustem detect it (everything is fine till here) but then i want a reaction in case the colour of the mask(maskcolour) is ex red>153 a picture of the mask (first one the pattern//mask second and third is the 2 colour that the mask can take) .So i want to check the colour of the mask (if it is pocible).>> Uploaded with ImageShack.us Quote Link to comment Share on other sites More sharing options...
Janilabo Posted December 28, 2012 Share Posted December 28, 2012 (edited) Wrote couple functions that will help you out with this. function GetWhiteTPAFromMask(Mask: TSCARBitmap): TPointArray; -Returns the white* points/pixels from Mask, as TPointArray [TPA] * = (clWhite - 16777215) function GetWhiteTPAFromMask(Mask: TSCARBitmap): TPointArray; var client: TSCARClient; begin client := SetClient(TSCARBitmapClient.Create(Mask)); try FindColorEx(Result, clWhite, 0, 0, (Mask.Width - 1), (Mask.Height - 1)); finally SetClient(client).Free; end; end; ..and... function FindBitmapMaskToleranceEx(Mask: TSCARBitmap; var x, y: Integer; var matchedColors: TIntArray; XS, YS, XE, YE, Tolerance, ContourTolerance: Integer): Boolean; -Extended version of FindBitmapMaskTolerance, this version stores all the matched colors to matchedColors, as TIntArray (array of Integer). Matched colors are the ones that are found with your masks white pixels. function FindBitmapMaskToleranceEx(Mask: TSCARBitmap; var x, y: Integer; var matchedColors: TIntArray; XS, YS, XE, YE, Tolerance, ContourTolerance: Integer): Boolean; var white: TPointArray; area: TBox; client: TSCARClient; bitmap: TSCARBitmap; begin SetLength(matchedColors, 0); if ((XS > XE) or (YS > YE)) then Exit; area := Box(XS, YS, XE, YE); OffsetBox(area, -XS, -YS); white := GetWhiteTPAFromMask(Mask); bitmap := GetClient.CaptureEx(XS, YS, XE, YE); try client := SetClient(TSCARBitmapClient.Create(bitmap)); try Result := FindBitmapMaskTolerance(Mask, x, y, area.X1, area.Y1, area.X2, area.Y2, Tolerance, ContourTolerance); if Result then begin OffsetTPA(white, x, y); matchedColors := GetColors(white); x := (XS + x); y := (YS + y); end; finally SetClient(client).Free; end; finally bitmap.Free; end; SetLength(white, 0); end; Included example in zip. That shows how it works. Although, I included loads of unneeded data (for debugging purposes), that you wont need in your script really. Hope it helps you out, -Jani Mask Color Matching.zip Edited December 28, 2012 by Janilabo Quote Link to comment Share on other sites More sharing options...
Janilabo Posted December 28, 2012 Share Posted December 28, 2012 Also, seafight.. If you need more help, just ask. If you want me to help you out a LOT more, then please upload the bitmap mask (Mask 1) here and also upload some screenshot(s) (BMP or PNG!) from in-game to webpage that doesn't convert to JPEG (like ImageShack automatically does!) The thing is, your image lost quality because of the JPG. Colors are messed up in it now. But I can tell you, I believe we can get this working for you, just the way you need it to work. Regards, -Jani Quote Link to comment Share on other sites More sharing options...