dando Posted September 22, 2013 Share Posted September 22, 2013 Can I make a script check for images instead of color ? and how would I do that ? For example if the script sees : Then it would for example println("Found cool"); instead of using: if find (Color that cool has) printn("Found color that cool has"); Quote Link to comment Share on other sites More sharing options...
LordJashin Posted September 23, 2013 Share Posted September 23, 2013 FindBitmap. Can find an image on the screen. Load from png, bmp, or jpeg file formats. Or from string format. Plenty of tutorials on this in the tutorials section of the forums. Quote Link to comment Share on other sites More sharing options...
dando Posted September 28, 2013 Author Share Posted September 28, 2013 I was able to code it. And this is what I use: TPA:TPointArray; K := TSCARBitmap.create(''); K.LoadFromPng(ScriptPath + '50k.png'); if FindBitmapEx(TPA,K,0,0,0,0) then begin XE := TPA.X + Item.width; YE := TPA.Y + Item.height; Mouse(XE,YE,0,0,false); sleep(300); end; But this doesn't look for the item in an AREA instead it only looks for it to where the image was taken. Now being where the image was taken was if I took it in the middle, then it'll only search in the middle. How can I make it search over a whole area ? Quote Link to comment Share on other sites More sharing options...
Janilabo Posted September 28, 2013 Share Posted September 28, 2013 Change the area coordinates? 0, 0, 0, 0 which are X-Start, Y-Start, X-End, Y-End.. (XS/X1, YS/Y1, XE/X2, YE/Y2) Simple change em to something like => 0, 0, (WIDTH - 1), (HEIGHT - 1) Quote Link to comment Share on other sites More sharing options...
dando Posted September 28, 2013 Author Share Posted September 28, 2013 Change the area coordinates?0, 0, 0, 0 which are X-Start, Y-Start, X-End, Y-End.. (XS/X1, YS/Y1, XE/X2, YE/Y2) Simple change em to something like => 0, 0, (WIDTH - 1), (HEIGHT - 1) Invalid search area. - - - Updated - - - What you don't understand is there is that I make a box with the X,Y,XS,YS. 0000 wast just an example. The bot despite the box that I put would ONLY click on the image if it is in the coordinates that I took the picture from. I want it to be able to click on it without that. Quote Link to comment Share on other sites More sharing options...
Janilabo Posted September 28, 2013 Share Posted September 28, 2013 Invalid search area. - - - Updated - - - What you don't understand is there is that I make a box with the X,Y,XS,YS. 0000 wast just an example. The bot despite the box that I put would ONLY click on the image if it is in the coordinates that I took the picture from. I want it to be able to click on it without that. You can control the results with TPA.. I see you already store all positions to TPA, but you are just clicking the first one (TPA), because you never declared i (not at least in your example). You can do like... SortTPAEx and then do TPA[0], so it would click to closest point from your wanted coordinates. if FindBitmapEx(TPA, K, 0, 0, 799, 599) then begin SortTPAEx(TPA, Point(400, 300)); // Sort from center point (by 800, 600) XE := (TPA[0].X + Item.width); // Dont you want (item.width div 2) instead? YE := (TPA[0].Y + Item.height); // Same here? Mouse(XE, YE, 0, 0, False); Sleep(300); end; Also, if you got invalid search area error, that means you didn't use the area coordinates correctly. Quote Link to comment Share on other sites More sharing options...
dando Posted September 28, 2013 Author Share Posted September 28, 2013 I used your example and it still won't click in the area, just at the image area it was taken. Quote Link to comment Share on other sites More sharing options...
Janilabo Posted September 28, 2013 Share Posted September 28, 2013 I used your example and it still won't click in the area, just at the image area it was taken.Hmm.. Could you visualize to me what you are trying to do?I am not sure exactly what you are after, it would be a lot easier if you shown example what you need to do.. Quote Link to comment Share on other sites More sharing options...
dando Posted September 28, 2013 Author Share Posted September 28, 2013 Hmm.. Could you visualize to me what you are trying to do?I am not sure exactly what you are after, it would be a lot easier if you shown example what you need to do.. I added you on skype, I can show you exactly what is going on. Quote Link to comment Share on other sites More sharing options...
slacky Posted September 29, 2013 Share Posted September 29, 2013 (edited) But this doesn't look for the item in an AREA instead it only looks for it to where the image was taken. Now being where the image was taken was if I took it in the middle, then it'll only search in the middle. How can I make it search over a whole area ? Sounds like the returned coordinates are Point(-1,-1)... which means the image was not found. SCAR's FindBitmap is super-strict. It requires the image to be a perfect match. If you use FindBitmapTol you will see that it tolerates a small change in the images color, tho no rotation (not even 1-2 degrees), or pixelshifting.. Tho even now it really does suck.. it's result is still super-strict.. Honestly.. Just avoid FindBitmap(whater)-functions. They are the weakest/worst functions found in SCAR. I am hoping that Freddy will do something about it. Even at the cost of performance. I my self is working on a FFT-CrossCorrelation for my newest library (for scar), but as this is really complicated it might just take some time before I get some fast matrix-image matching, if even... On the other side.. I had one to many drinks to really be a judge here ^^ Edited September 29, 2013 by slacky Quote Link to comment Share on other sites More sharing options...