SRL Archive - General Botting Help

Script Crashes chrome after a couple of hours


newguy45

2015-04-11 11:38:44

Guys my simba script has been crashing chrome, it only happens after 2 - 3 hours have past. I noticed that simba will he hogging up memory when I wake up. I get this warning message that the minimap mask has not been released can someone help me with this?



program SetSail;
{$I SRL-6/SRL.Simba}
var
glitchCount, c, d, i: Integer;
arP: TPointArray;

const
BUNKERTYPE = 'any'; //cheap or any
SETSAILS = 1; //how many times you want the bot to try to send your boats off before it buys bunker

procedure DirtyWork;
var X, Y, a, b: Integer;
begin
if(FindColorsSpiralTolerance(680, 535, arP, 9728565, 883, 405, 953, 434, 26))then //1
begin
wait(600);
Mouse(691, 793, 4, 4, MOUSE_LEFT);
wait(3000);
Mouse(660, 255, 4, 4, MOUSE_LEFT);
writeln('Ships sent off, waiting');
wait(gaussRangeInt(50000, 130000));
Mouse(652, 273, 4, 4, MOUSE_LEFT);
wait(3000);
end else
begin
writeln('No ships to send out, waiting');
wait(gaussRangeInt(50000, 130000));
Mouse(652, 273, 4, 4, MOUSE_LEFT);
wait(3000);
end;
end;

procedure sendFirstFleet;
var X, Y: Integer;
begin
if(FindColorsSpiralTolerance(680, 535, arP, 9728565, 883, 405, 953, 434, 26))then //1
begin
wait(600);
Mouse(691, 793, 4, 4, MOUSE_LEFT);
wait(gaussRangeInt(1000, 3000));
Mouse(660, 255, 4, 4, MOUSE_LEFT);
wait(gaussRangeInt(1000, 2000));
writeln('Ships sent off waiting 3 mins');
Mouse(652, 273, 4, 4, MOUSE_LEFT);
wait(gaussRangeInt(1000, 3000));
end else
begin
writeln('no ships');
end;
end;

procedure glitchCheck;
var X, Y, a, b, i: Integer;
begin
if not(FindColor(X,Y, 9272929,617, 378, 666, 398))then
begin
Inc(glitchCount);
wait(1000);
Mouse(649, 270, 4, 4, MOUSE_LEFT);
if(glitchCount <= 1)then
begin
writeln('fixed '+ IntToStr(glitchCount) +' glitch');
end else
begin
writeln('fixed '+ IntToStr(glitchCount) +' glitches');
end;
wait(gaussRangeInt(3000, 5000));
end else
writeln('No glitch');
end;

procedure buyBunker;
var x, y: Integer;
begin
Mouse(853, 271, 4, 4, MOUSE_LEFT);
wait(gaussRangeInt(1000, 3000));
If(BUNKERTYPE='any')Then
begin
Mouse(725, 334, 4, 4, MOUSE_LEFT);
wait(gaussRangeInt(1000, 1500));
repeat
Mouse(855, 377, 4, 4, MOUSE_LEFT);
SendKeys(IntToStr(gaussRangeInt(100, 400)), 155, 155); // random number between 100 and 400
wait(gaussRangeInt(1000, 1500));
Mouse(865, 434, 4, 4, MOUSE_LEFT);
wait(gaussRangeInt(1000, 1500));
until(FindColor(x,y, 11857918,858, 456, 909, 488));
Mouse(913, 262, 4, 4, MOUSE_LEFT);
end;
end

function AutoColor: Integer;
var

arC: TIntegerArray;
tmpCTS, i, arL: Integer;
H, S, L: Extended;
X, Y, Z: Extended;
begin
tmpCTS := GetToleranceSpeed;
SetColorToleranceSpeed(1);

FindColorsSpiralTolerance(680, 535, arP, 9728565, 883, 405, 953, 434, 26);
if (Length(arP) = 0) then
begin
Writeln('Failed to find the color, no result.');
SetColorToleranceSpeed(tmpCTS);
Exit;
end;

arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);

for i := 0 to arL do
begin
ColorToHSL(arC[i], H, S, L);

if (H >= 55.54) and (H <= 56.25) and (S >= 35.46) and (S <= 57.23) and (L >= 36.45) and (L <= 42.18) then
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 10.56) and (X <= 15.39) and (Y >= 12.35) and (Y <= 17.63) and (Z >= 21.54) and (Z <= 40.13) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;
end;

SetColorToleranceSpeed(tmpCTS);

if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;

begin
AutoColor;

repeat
if (i = SETSAILS) then
begin
buyBunker;
i := 0;
end;
glitchCheck;
wait(gaussRangeInt(1000, 1500));
//FuelTheShips;
sendFirstFleet;
wait(gaussRangeInt(1000, 1500));
glitchCheck;
sendFirstFleet;
wait(gaussRangeInt(1000, 1500));
glitchCheck;
//FuelTheShips;
DirtyWork;
glitchCheck;
wait(gaussRangeInt(1000, 1500));
Inc(i);
until( false );
end.

rj

2015-04-11 11:49:08

Maybe try to draw the client when the script crashes and see what is happening

Procedure drawClient();
var
bmp, w, h:integer;
begin
getClientDimensions(w, h);
bmp := bitmapFromClient(0, 0, w-1, h-1);
DisplayDebugImgWindow(w, h);
DrawBitmapDebugImg(bmp);
freebitmap(bmp);
end;

In your mainloop add


addOnTerminate('drawClient');

bg5

2015-04-11 11:53:30

So chrome crashes, because memory is stacking inside a Simba? I usually see memory leaks caused by bitmaps, DTMs, plugins or some tricky custom types. I can't see anything like this in your script, anything which would give a chance of leaking.

newguy45

2015-04-11 13:09:23

Yah the crashes only started after I added SRL support to my script. I am getting this message though

The following bitmaps were not freed: [Minimap Mask]

newguy45

2015-04-11 13:10:37

From: rj
Maybe try to draw the client when the script crashes and see what is happening

Procedure drawClient();
var
bmp, w, h:integer;
begin
getClientDimensions(w, h);
bmp := bitmapFromClient(0, 0, w-1, h-1);
DisplayDebugImgWindow(w, h);
DrawBitmapDebugImg(bmp);
freebitmap(bmp);
end;

In your mainloop add


addOnTerminate('drawClient');


Whats that do? My script never crashes. only chrome.

rj

2015-04-11 13:40:22

From: newguy45
Whats that do? My script never crashes. only chrome.


Maybe constantly call this in your script:

Procedure drawClient();
var
lastScreen, w, h:integer;
begin
getClientDimensions(w, h);
if isTargetValid() then // target valid so we will take a screenshot of the client
begin
if bitmapExists(lastScreen) then
freebitmap(lastScreen);
lastScreen := bitmapFromClient(0, 0, w-1, h-1);
DrawBitmapDebugImg(lastScreen);
end else // target not valid so we will terminate the script and show a screenshot of the last time the client was valid
begin
freebitmap(lastScreen);
DisplayDebugImgWindow(w+1, h+1); // throws a error here when the script terminates for some reason.. whatever though
terminateScript();
end;
end;

It will take a screenshot of your selected client, and if the client crashes the script will terminate and display a screenshot of the last time the client was shown (so maybe you can see if it is something on chromes end)

KeepBotting

2015-04-11 15:43:29

Unrelated Q: why not use Appa?

Harrier

2015-04-11 15:44:34

From: KeepBotting
Unrelated Q: why not use Appa?

I don't think it supports the newer versions of flash with most facebook games require

bg5

2015-04-11 16:12:45

From: newguy45
Yah the crashes only started after I added SRL support to my script. I am getting this message though

The following bitmaps were not freed: [Minimap Mask]


I don't see SetupSRL(); in your script. So theoretically none of SRL stuff should be initialized? @Olly

newguy45

2015-04-11 16:39:58

From: bg5
I don't see SetupSRL(); in your script. So theoretically none of SRL stuff should be initialized? @Olly



yah, Originally I had SetupSRL(); in it but it was complaining about SMART bot being initialized and it waits 5 minuets for rs to load

KeepBotting

2015-04-11 17:45:34

From: newguy45
yah, Originally I had SetupSRL(); in it but it was complaining about SMART bot being initialized and it waits 5 minuets for rs to load

Were you
{$define smart}
-ing too? You can include SRL-6 and not define SMART. It might still look for an RS client, but you can figure out which procedure does the waiting and override it to always return true. I'd elaborate but I don't have Simba & SRL handy to test with.

E: Just searched the repo, it's waitClientReady()

So

function waitClientReady(): boolean; override;
begin
exit(true);
end;

I guess that's the easiest way to initialize SRL-6 without it looking for RS.