Jump to content
Doom989

recognize 3 random images

Recommended Posts

Hello, I'm trying to write a script that looks at three images, and if they aren't the same to click on the screen on the ones that dont match up to randomly the 1st 2nd or 3rd image.

 

As I'm very new to this I was wondering if someone would give an idea on how to accomplish this, thank you for reading.

Link to comment
Share on other sites

This is quite easy. SimilarBitmaps(Bmp1: TSCARBitmap, Bmp2: TSCARBitmap, Tol: LongInt): Boolean;. You need to use the Bitmap picker, to choose the bitmap you want to use (which will convert it for use in SCAR). Or you can load it from a file.

 

If you use the bitmap tool you can pick a bitmap, and you will get something like this in the debug box: Bmp := TSCARBitmap.Create('deNpjZGBk+P//PwAGDQMA'); So in order to tell if 2 bitmaps were the same you would have to pull both of them, so that there are the same size and everything then just compare them with that function like this:

 

[scar]

program New;

var

Bmp1, Bmp2, Bmp3: TSCARBitmap;

 

begin

Bmp1 := TSCARBitmap.Create('deNpjZGBk+P//PwAGDQMA');

Bmp2 := TSCARBitmap.Create('deNpjZGBk+P//PwAGDQMA');

if SimilarBitmaps(Bmp1, Bmp2, 0) then

WriteLn('They are the same images!');

 

// Loading from a file you need to create the bitmap first! like so

Bmp3 := TSCARBitmap.Create('');

// Then use this method for a png for example:

Bmp3.LoadFromPng('C:\1.png');

end.

 

[/scar]

Link to comment
Share on other sites

Thank you so much :D I really needed to see those mate.

Quick question; can Bmp := TSCARBitmap.Create be used to look in coordinates for the images rather than having them defined? The 3 bitmaps change alot.(its like a jackpot reel, only you get 3 spins on each slot. usually there are 4 random types per reel per spin). To add all possible cards would take quite a long time.

Link to comment
Share on other sites

Thank you so much :D I really needed to see those mate.

Quick question; can Bmp := TSCARBitmap.Create be used to look in coordinates for the images rather than having them defined? The 3 bitmaps change alot.(its like a jackpot reel, only you get 3 spins on each slot. usually there are 4 random types per reel per spin). To add all possible cards would take quite a long time.

 

You can FindBitmaps as well. You can change the same Bmp1 to other bitmaps if you want. So example:

 

[scar]

program New;

var

Bmp1: TSCARBitmap;

x, y: Integer;

 

begin

Bmp1 := TSCARBitmap.Create('deNqTZBBj+D8KRsEoGAWjYBTQBQAAPwNsGA==');

GetClient.Activate;

with GetClient.ImageArea do

if FindBitmap(x, y, Bmp1, 0, 0, X2 - 1, Y2 - 1) then

begin

MoveMouse(x, y);

WriteLn('Found bitmap1 in the client (w/e u selected with SCAR''s crosshairs(+)');

Bmp1.Free;

Bmp1 := TSCARBitmap.Create('deNrt0kENAEAIBDEs4f+zKs7OoYEnSSthMq+6P' +

'ktJRMCBOBAciAPBgTgQHIgDwYE4EByIA8GBOBAciAPBgTgQHIgDwYE4EByIA8G' +

'BOBAciAPBgTgQHIgDwYE4EByIA8GBOBAciAPBgTgQB4qAA3EgOBAHggNPGzq7S' +

'x8=');

 

// do another search here, etc.

end;

end.

 

[/scar]

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