Jump to content
dando

Check interface (Images) instead of color?

Recommended Posts

Can I make a script check for images instead of color ? and how would I do that ?

 

For example if the script sees : B|

Then it would for example println("Found cool");

 

instead of using:

 

if find (Color that cool has)

printn("Found color that cool has");

Link to comment
Share on other sites

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 ?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 by slacky
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...