Jump to content
LordJashin

Best Search Functions for SCAR Divi, the big idea

Recommended Posts

So SCAR Divi has done well with automating things, and has been known for its Color Finding.

SCAR has so many good things about it now and its functionality!

 

The Big Idea:

 

Color finding, and Points are very powerful. When the Size of the window doesn't change, and objects appear in certain places, then Points are

VERY instrumental. But they would be nothing without color/bitmap/DTM finding. The big idea is to be able to use all of these in one function or

a couple. And have the function optimized by accuracy. So the most accurate finding technique? Well combining the usage of Points & Color arrays

seems to be the best way. You could also measure the distance from points, and many things. Then next would be just Color arrays. Could start

off there by trying to CountColors & Other color functions at the same time (whatever is most accurate). Then we could do a Find bitmap thing.

Now last off would be DTM's. Dtm's are very powerful too, and tolerance is very important in these functions. This could be used as a last resort

or not. COULD ALSO ADD TEXT FINDING TOO!

 

 

 

 

 

 

Result:: FindMultiAcc(TPA: TPointArray; arrColor: T2DIntArray; Bmp: TSCARBitmap; DTM: Integer; etc etc as needed): Integer; // or boolean result possibly

 

 

I think you would all agree that the Main issue with making bots for like RS2, RSC, and etc. Is this exactly. Especially if color changes a lot. We could also use Animation detection?!

Anyway, eventually I will be doing this if no1 else does.

 

Here is my Bmp->Dtm fall back function (still probably needs to be better), This is over in Divi\Level 3\Multi.scar:

 

[scar]

 

{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

function FindBitmapAndDtm(out X, Y: Integer; Bmp: TSCARBitmap; DTM: Integer; PrefDTM: Boolean): Integer;

Contributors: LordJashin

Date Created: November 8th, 2012. By LordJashin.

Last Modified: November 8th, 2012. By LordJashin.

Explanation: If PrefDTM is set to TRUE, then X, Y will always be set as where the DTM was found (if it was found)

regardless of whether bmp was found or not. So by default Bitmaps are preferred and here's how:

Result of 0: Nothing found...

1: Bmp & DTM found, DTM found inside of where Bmp is, X, Y = Where Bmp was found

2: Bmp & DTM found, DTM not found inside of where Bmp is, X, Y = Where Bmp was found

3: Bmp found, but DTM not found, X, Y = Where Bmp was found

4: DTM found, but Bmp not found, X, Y = Where DTM was found

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}

 

function FindBitmapAndDtm(out X, Y: Integer; Bmp: TSCARBitmap; DTM: Integer; PrefDTM: Boolean): Integer;

var

P1, P2: TPoint;

CBox: TBox;

begin

Result := 0;

CBox := GetClient.ImageArea;

if FindBitmap(P1.X, P1.Y, Bmp, 0, 0, CBox.X2, CBox.Y2) then

begin

if FindDTM(DTM, P2.X, P2.Y, 0, 0, CBox.X2, CBox.Y2) then

begin

if PointInBox(P2, Box(P1.X, P1.Y, P1.X + Bmp.Width, P1.Y + Bmp.Height)) then

Result := 1

else

Result := 2;

end

else

Result := 3;

end

else

begin

if FindDTM(DTM, P2.X, P2.Y, 0, 0, CBox.X2, CBox.Y2) then

Result := 4;

end;

if PrefDTM then

case Result of

1, 2, 4: PointToCoord(P2, X, Y);

3: PointToCoord(P1, X, Y);

end

else

case Result of

1, 2, 3: PointToCoord(P1, X, Y);

4: PointToCoord(P2, X, Y);

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