• Log in or sign up for an account here: https://www.sythe.org/login

Having a problem with detecting bitmaps

kk0425

Newcomer
Joined
Dec 18, 2009
Sythe Gold
0
Messages
1
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.
 
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.
 
Runescape Gamblingrunescape gambling
Back
Top