SRL Archive - Other Language Help and Tutorials

Need some bitmap help


newguy45

2015-03-29 20:25:05

Hello all I'm writing a script for a facebook game called shipping manager, the idea is it's going to fuel up my ships and send them on their routes every three minuets.

[ATTACH=CONFIG]25412[/ATTACH]
this is what the screen looks like

now what my script does is it looks for the depart button on every line and clicks beside it to bring up the fuel screen. My only problem is my bitmaps are horribly unreliable. I've try tiny bitmaps to medium bitmaps of the depart button but simba is always randomly throwing me cant find the bitmap messages.

here is my code , any advice or help is greatly appreciated.


program SetSail;
var count:integer;

procedure Fuel1; //detects the depart button on the first line
var DepartDetect, X, Y: Integer;
begin
DepartDetect := BitmapFromString(19, 2, 'meJzryTPvyTc/uWv+9y/vLh5ZC2T' +
'vWt765cPLQ5umANk9YFkICRT/+uHF4U2T+/JN+/JM+wsgyOz07vnf' +
'Pr1eOzVr9wqQxsObpwAFkRFE/MjmyRMLTIAIAMo6QNY=');
if (FindBitmapIn(DepartDetect, X, Y, 912, 503, 985, 540)) Then
begin
writeln('found Depart Button');
MoveMouse(665, 515);
wait(200);
ClickMouse(665, 515, mouse_Left);
wait(1200);
MoveMouse(871, 340);
wait(400);
ClickMouse(871, 340, mouse_Left);
wait(400);
MoveMouse(952, 317);
wait(400);
ClickMouse(952, 317, mouse_Left);
end else
writeln('Did not find Depart Button 1');
FreeBitmap(DepartDetect);
end;

procedure Fuel2; //detects the depart button on the second line
var DepartDetect2, X, Y: Integer;
begin
DepartDetect2 := BitmapFromString(20, 4, 'meJz78Or++v6IQ2uav358eWrbpDm' +
'lRkD2t0+vrh1fDWTPKTOGiMBlISIQ8suH5zdOrD6ytgkoe3r7xPnl' +
'RvPLDS/um/vt0+sds9KBbKAImiycfHbn5OvHl4+tA8me3T5xUaXBo' +
'kpDIAkUB2rfNScdyMaUhZBLK/WXVeqTRwIAZWaJCw==');
if (FindBitmapIn(DepartDetect2, X, Y, 908, 558, 989, 593)) Then
begin
writeln('found Depart Button');
MoveMouse(623, 576);
wait(200);
ClickMouse(623, 576, mouse_Left);
wait(1200);
MoveMouse(871, 340);
wait(400);
ClickMouse(871, 340, mouse_Left);
wait(400);
MoveMouse(952, 317);
wait(400);
ClickMouse(952, 317, mouse_Left);
end else
writeln('Did not find Depart Button 2');
FreeBitmap(DepartDetect2);
end;

procedure Fuel3; //detects the depart button on the third line
var DepartDetect3, X, Y: Integer;
begin
DepartDetect3 := BitmapFromString(26, 8, 'meJylkNtKAlEUht+pUSd7gO4rKCJ' +
'6gTHtZD2A2mQiVI6KnbCEyjwglIVYFo2YZnVRjEZJmlnqTHlonNTL' +
'lm6TIO+CxeLf3/+xZzMkISEJnCQkczJpc3r+s8vs06Z2RDeGa+XdC' +
'3LpqmqwUsrl0gxkRHw75Bf/XhOKaKr8u52SramGQGvDVlX5yDxEym' +
'xySzeqH8f1CvzSb2UzMb6YpfeNiPjtc0KZbRwVOJD7ax9c6KBkHds' +
'tTZ9QeA0eGBcnJDCZx+hdyA07ydCIHDf9ttA85t0momN7alcJn2zo' +
'gDJMim3kALzKYyKuTqwlLrWrHzFMiAN7GvBDXgoyOPChfJpB+W/79' +
'hBhXxjztNg8Jb4JWFHenu+vFLNhLwX5zKH54rn2z2EuXGAiv9V+ss' +
'gEwqVvV5SiFSUGO5uIxsMuixKzKEVviehzjIZ87mz4kUODTdVbyD4' +
'2oQg5v1tENma6GjOLBV3qGs/VhUL95xllLuVZGqZdavCjR8vrsxjk' +
'Ks/Fw07I6zNdiLRbIN9/3n/Y');

if (FindBitmapIn(DepartDetect3, X, Y, 909, 610, 992, 650)) Then
begin
writeln('found Depart Button');
MoveMouse(628, 627);
wait(200);
ClickMouse(628, 627, mouse_Left);
wait(1200);
MoveMouse(871, 340);
wait(400);
ClickMouse(871, 340, mouse_Left);
wait(400);
MoveMouse(952, 317);
wait(400);
ClickMouse(952, 317, mouse_Left);
end else
writeln('Did not find Depart Button 3');
FreeBitmap(DepartDetect3);
end;

procedure Fuel4; //detects the depart button on the forth line
var DepartDetect4, X, Y: Integer;
begin
DepartDetect4 := BitmapFromString(15, 6, 'meJxrzbZqzbZszbZqy7ZohbFxkR2' +
'5Fp25lkByx7K2r59ef//yDoK+fXq9YnLOrKawz++fwwUPbZrSk2fe' +
'k2++a3nrlw8vQdx8c6DI9TM7gOpXTclGlr135VB/gRkQ7VnRAuQe3' +
'jwFwt29Aij7Yu3ULCTuy/ev7i/vjp5UaLp3ZcuXjy+Pbp4MZE8qMH' +
'1869SLh1cgbLjs53fPjm+dPK3I9MCq5q+fXsGdd+XYmmnFpkBxCLl' +
'/VcvXjy8BIIel/A==');

if (FindBitmapIn(DepartDetect4, X, Y, 910, 665, 995, 703)) Then
begin
writeln('found Depart Button');
MoveMouse(601, 683);
wait(200);
ClickMouse(601, 683, mouse_Left);
wait(1200);
MoveMouse(871, 340);
wait(400);
ClickMouse(871, 340, mouse_Left);
wait(400);
MoveMouse(952, 317);
wait(400);
ClickMouse(952, 317, mouse_Left);
end else
writeln('Did not find Depart Button 4');
FreeBitmap(DepartDetect4);
end;

procedure Madness;
var Hide, X, Y: Integer;
begin
wait(600);
MoveMouse(660, 733); //click send ships
wait(400);
ClickMouse(660, 733, mouse_Left);
wait(2000);
Hide := BitmapFromString(19, 4, 'meJxtz0EKgzAQBdATqfFkweol3Bp' +
'QCOgRkrlGk31LS8mmKri0i5Ld9GtBumhWn/dnEsK8ncisjH8aEfnV' +
'GH+ROXNQ59BIoWT+6xFuPLwrxGg3b62f9tBZfwjathCHXwuBC/enW' +
'J/SibLIqyYsphjQ1t1KSICg1WX214cqnSnBYk9uJgysA7m+Snih+8' +
'JokeOjxl++jjy/4fUHKpKfEQ==');

if (FindBitmapIn(Hide, X, Y, 629, 327, 715, 544)) Then
begin
writeln('found Hide Button');
MoveMouse(X, Y);
wait(200);
ClickMouse(X, Y, mouse_Left);
wait(180000);
MoveMouse(580, 332); //click routes
wait(400);
ClickMouse(580, 332, mouse_Left);
wait(3000);
end else
writeln('No ships avalible, checking again in three mins');
MoveMouse(580, 332); //click routes
wait(180000);
ClickMouse(580, 332, mouse_Left);
FreeBitmap(Hide);
end;

procedure DetectGlitch;
var Glitch, X, Y: Integer;
begin
wait(400);

Glitch := BitmapFromString(21, 9, 'meJzb/P7f5lE0ikhEAE6S8DA=');
if (FindBitmapIn(Glitch, X, Y, 738, 247, 932, 270)) Then
begin
writeln('found Glitch!');
MoveMouse(662, 253);
wait(200);
ClickMouse(662, 253, mouse_Left);
wait(1200);
end else
writeln('No Glitch!');
end;

begin
repeat
wait(400);
DetectGlitch;
wait(2000);
Fuel1;
wait(2000);
Fuel2;
wait(2000);
Fuel3;
wait(2000);
Fuel4;
wait(200);
Madness;
until( false );
end.

Turpinator

2015-03-29 21:02:02

FindBitmapToleranceIn()?

iEatApplez

2015-03-29 21:35:06

FindDeformedBitmapToleranceIn()?

newguy45

2015-03-29 21:45:37

the button does not change from what I can tell or change color

iEatApplez

2015-03-29 21:49:52

From: newguy45
the button does not change from what I can tell or change color


When hovering over maybe? I've experienced that problem with the close button on your bank. It changes when you hover your mouse over it.

newguy45

2015-03-30 03:23:59

I've managed to fix the problem, I was timing things a little too quick but I am still having an issue with unfreed bitmaps. I left it running for a few hours and ran into this feed back after I killed the script

The following bitmaps were not freed: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62]

Justin

2015-03-30 03:27:33

From: newguy45
I've managed to fix the problem, I was timing things a little too quick but I am still having an issue with unfreed bitmaps. I left it running for a few hours and ran into this feed back after I killed the script

The following bitmaps were not freed: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62]


You never free your 'Glitch' bitmap

newguy45

2015-03-30 09:17:52

thank you ^.^