Results 1 to 7 of 7

Thread: FindBitMapInBitmap Function?

  1. #1
    Join Date
    Oct 2006
    Posts
    119
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default FindBitMapInBitmap Function?

    Anyone have any idea's how i would find/make something happen like a FindBitmapInBitmap like while it still has the RS Client activated?

    I'd like to take a picture of the Minimap, crop it so its just the minimap, rotate the minimap degrees, then search for bitmaps in it.

    I have it working right now where the script just hits the over arrow, but if the computers slow i've figured out it makes it lag so bad that my function wont work with it.

    I know how to use canvas to crop the minimap, i know how to rotate the cropped mini map, i just don't know how i would make SCAR search for a bitmap within that bitmap instead of the scar client.

    Any help is greatful, even if all you say is "no idea." Then it means i can start googleing and learning pascal or w/e.

  2. #2
    Join Date
    Sep 2006
    Posts
    5,219
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    Yakman might know.

  3. #3
    Join Date
    Feb 2006
    Posts
    406
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    kk, good question

    heres what you want to do:
    first, copy the client handle to an integer so you can go back to it later:
    Handle := GetClientWindowHandle;

    initalize your bitmaps by doing:
    ScreenBmp := BitmapFromString(Width, Height, '');

    then copy the client to the bitmap:
    CopyClientToBitmap(ScreenBmp, X1, Y1, X2, Y2);

    you can then set the bitmap as the target for color/bitmap searching by using
    SetTargetBitmap(ScreenBmp);

    do your searching, then set the handle back with
    SetClientWindowHandle(Handle);

    thats probably what you want
    there are ways of manipulating canvases with ellipses so you get only the minimap and not the border, but thats kinda tricky even for me

    look at findcolorellipse in srl for how to do that, or this little program i made out of it with a debug window

    Code:
    program aweso;
    
    procedure DebugEllipse(X1, Y1, X2, Y2: Integer);
    var
      Debug,Temp: TCanvas;
      H, W, ScreenBmp, TempBmp: Integer;
    begin
      W := Max(X1, X2) - Min(X1, X2);
      H := Max(Y1, Y2) - Min(Y1, Y2);
      TempBmp := BitmapFromString(W, H, '');
      Temp := GetBitmapCanvas(TempBmp);
      ScreenBmp := BitmapFromString(W, H, '');
    
      FastDrawClear(TempBmp, -1);
      CopyClientToBitmap(ScreenBmp, X1, Y1, X2, Y2);
    
      CopyCanvas(GetBitmapCanvas(TempBmp), Temp, 0, 0, W, H, 0, 0, W, H);
      Temp.Ellipse(0, 0, W, H);
      CopyCanvas(Temp, GetBitmapCanvas(TempBmp), 0, 0, W, H, 0, 0, W, H);
      SetTransparentColor(TempBmp, 16777215);
      FastDrawTransparent(0, 0, TempBmp, ScreenBmp);
    
      displaydebugimgwindow(w,h);
      debug:=getdebugcanvas;
      copycanvas(getbitmapcanvas(screenbmp),debug,0,0,w,h,0,0,w,h);
    
      FreeBitmap(TempBmp);
      FreeBitmap(ScreenBmp);
    end;
    
    begin
    debugellipse(575,9,720,143)
    end.
    edit: sorry, i didnt read that you already know how to do that, all you need is the
    SetTargetBitmap(ScreenBmp);

  4. #4
    Join Date
    Sep 2006
    Posts
    5,219
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    Don't worry, good for people who don't know that part (me).

  5. #5
    Join Date
    Sep 2006
    Location
    Scripter's Heaven
    Posts
    455
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    ahh, make a DTM which is just a bitmap and do findDTMrotated()! it does it all for you!

    And check out my pascal interpreter!
    <R0b0t1> No, really, I went to a bar and picked up a transvestite.

  6. #6
    Join Date
    Oct 2006
    Posts
    119
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks a bunch!

  7. #7
    Join Date
    Oct 2006
    Posts
    119
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yea that ellipse thing is better than what i was doing lol, so ill toss it it Ty

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 2
    Last Post: 02-27-2008, 05:20 PM
  2. Replies: 2
    Last Post: 02-26-2008, 08:26 PM
  3. [FUNCTION] FindDoorColour: integer; By ZephyrsFury [FUNCTION]
    By ZephyrsFury in forum Research & Development Lounge
    Replies: 10
    Last Post: 07-27-2007, 08:45 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •