Having a problem with detecting bitmaps

Discussion in 'Scar/Simba Help' started by kk0425, Dec 18, 2009.

Having a problem with detecting bitmaps
  1. Unread #1 - Dec 18, 2009 at 11:10 PM
  2. kk0425
    Joined:
    Dec 18, 2009
    Posts:
    1
    Referrals:
    0
    Sythe Gold:
    0

    kk0425 Newcomer

    Having a problem with detecting bitmaps

    I'm really new at this, and I've read a bunch of tuts on how to do this, but I still have problems with detecting the proper image. Sometimes the mouse moves but never the correct spot, and other times it doesn't move at all, depending on what code I have tried.

    I'm using scar 3.22, and here is my most recent code.

    Code:
    program New;
    // Declare variables.
    // Declaring vampegg bmp, mouse x and mouse y var
    var
    vampegg: Integer;
    x, y: Integer;
    
    procedure loadbmps;
    begin
    // The bitmap of the vampire egg in code
    vampegg := BitmapFromString(26, 29, 'beNrV1bENgzAQBVBmoKdhg' +
           'YgBkFJSRvQZIGNkC1Zgy5z0pa/T9/kMCU2s3xDjp+NsSNf99XitK3' +
           'OVgzyXxfKj8x4Grz3m2XKQ4lpSCEFoa98fobyGy33bbK3Fl4dfms8' +
           'YgqCogbpP06m2S9+kdaYlYI0qa2tqSWFsmmgJmBQW7kKihYgPNEa0' +
           '2ziWmghhbcKWGilbJTsoheExcUJwA0DTCIZnPtwFajy9Na2WsjBp2' +
           'ikNIKlSA3VQQ5eahVHjneWnjD0XKtFs2KxfLvEHrElBY4TC9oVUTb' +
           'NhU1IAv4o8/95JKGg+Asqsp0LNBqZkFV+o0KlRHmQIhk5O1cwwZ/8' +
           'Hr3K+HB9kOG+H');
    end;
    
    procedure moveclick;
    begin
    if(findbitmap(vampegg,x,y))then
    begin
    movemouse(x, y)
    wait(200)
    clickmouse(x, y, true)   //True = left click; False = right click
    end;
    end;
    
    begin
    loadbmps;
    moveclick;
    FreeBitmap(vampegg);
    end.
    
    Right now it is very simplified, and later I'm going make it repeat every few seconds and refresh the browser, but not until I can figure this out. I'm sure it is something really simple but I don't know. If anybody else knows, that would be a great help. Thanks!

    -------------------------------------------------------------------------
    Edit* Okay I found out what was wrong. I think the bitmap string was too long. I found another tut at http://www.villavu.com/forum/showthread.php?t=49089 that explained to use a smaller part of the image which helped out a lot.
     
  3. Unread #2 - Dec 29, 2009 at 10:34 PM
  4. yahretzkee
    Joined:
    Jul 25, 2008
    Posts:
    49
    Referrals:
    0
    Sythe Gold:
    0

    yahretzkee Member

    Having a problem with detecting bitmaps

    Try this:
    Code:
    program New;
    
    
    var
    vampegg,x,y: Integer;
    
    procedure LoadBMPs;
    begin
    
    vampegg := BitmapFromString(26, 29, 'beNrV1bENgzAQBVBmoKdhg' +
           'YgBkFJSRvQZIGNkC1Zgy5z0pa/T9/kMCU2s3xDjp+NsSNf99XitK3' +
           'OVgzyXxfKj8x4Grz3m2XKQ4lpSCEFoa98fobyGy33bbK3Fl4dfms8' +
           'YgqCogbpP06m2S9+kdaYlYI0qa2tqSWFsmmgJmBQW7kKihYgPNEa0' +
           '2ziWmghhbcKWGilbJTsoheExcUJwA0DTCIZnPtwFajy9Na2WsjBp2' +
           'ikNIKlSA3VQQ5eahVHjneWnjD0XKtFs2KxfLvEHrElBY4TC9oVUTb' +
           'NhU1IAv4o8/95JKGg+Asqsp0LNBqZkFV+o0KlRHmQIhk5O1cwwZ/8' +
           'Hr3K+HB9kOG+H');
    end;
    
    procedure MoveClick;
    begin
         if Findbitmap(vampegg,x,y) then
         begin
              Mouse(x,y,3,3);
         end;
    end;
    
    begin
         LoadBMPs;
         MoveClick;
    end.
     
< I'm new to scar, and... | I have a problem with 'CreateTPAFromBMP' >

Users viewing this thread
1 guest


 
 
Adblock breaks this site