Log in

View Full Version : The Following bitmaps were not freed: [4]



anuparockz
08-21-2012, 05:50 AM
I get this error almost everytime a script runs for about 20-30 minutes. Sometimes the [4] is replaced with [3]. What seems to be the error? Oh and here's the script itself.

program HunterKitterOpener;
{$DEFINE SMART}
{$i SRL/SRL.simba}

{*********************************************
*********** Prices will fluctuate! ***********
***** Change line 97 for precise prices! *****
**********************************************}


Const
AmountOfKits = 50000;
WhichBankTab = 1; //1-9

Var
X, Y, Profit, Kits, Kit: Integer;

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

with Players[0] do
begin
Name :=''; //Username
Pass :=''; //Password
Pin :=''; //Leave blank if none
Member := true; //no touchy
Active := true; //no touchy
end;
end;
procedure CallThings;
begin
Kit := BitmapFromString(24, 17, 'meJxt1O1v0lAUx/HFN4tP08lYBQ' +
'ZlhRa6FkpbSqFreSiP3YAxGWoIQdS5mCzGGOP/748cc3MDJt93TT+' +
'95yanhj839qoEC9QcrfzBklXvzIv2MF9uiUUXZRTnLG8lZB09 OTio' +
'TlbW9RJp7livT1klb8aHpwWzB+T8wiMErwuSSsFxbtYIGgPxU aQ6E' +
'R8QSQ8IiQupNycCCfGsguDUbjcUgWrJQZXRwhjMZSNk/UMMN6M75B' +
'y9jkGIpSUEp3F3786/UJrhkqNcWHBKvZnWHqvNqOgP5Xoo2QGct0m' +
'ROQjIcVKE471/QCXTQ7yTLxr7zrnpMYeo5y+OXgkpOP7y0agGzCEK' +
'DoKjh1PeSaalfefw8Ckcs9aCQ9SOgyPxTt5pMYeNdhIXgNi2H fbH7' +
'W4UdIb/dSRZZ046q/BO6kwUEinmTB/+kIMum72GH/JXhHBFcApejz' +
'lZScmIEjmpvErO5NtvRBQ5rtdy3ACRgyPBEXMqHKWo52SVd0T VIGf' +
'89RfFO0RZjlex3HLF0UoWUjVjxwGSKzvkXH3+SZHDH4mcejSv DWd2' +
'd7zvACnYHjnRpx+sndHgXE4+NK4X5JjtiHdk0wWiOsFp1gI1W j/y8' +
'U7zduXfLMmp9qdwyn6PORDiGQPrlpS2VzRYfd+JnM7dhjkYjZ xKc6' +
'h7IRwg2Ljt1ot6LLHdr1p/Uw1XVnuZs6es7sd7OK13azgYjRyMRo5' +
'W3/498PMR0urxqfjsZQzOXyP58G0=');
end;
procedure FreeThings;
begin
FreeBitmap(Kit);
end;
Procedure HumanMMouse(eX, eY, ranX, ranY: Integer);
var
randSpeed: extended;
X,Y,X2,Y2,A,Dist,MP: integer;
begin
A := MouseSpeed;
GetMousePos(X, Y);
Dist := Distance(X, Y, eX, eY);
MP := Round(Dist/150);
if MP < 0 then
MP := 1;

randSpeed := (random(MouseSpeed) / 2.0 + MouseSpeed) / 10.0;
X2 := RandomRange(eX-(A*MP), eX+(A*MP));
Y2 := RandomRange(eY-(A*MP), eY+(A*MP));
WindMouse(X, Y, X2, Y2, 11, 8, 10.0 / randSpeed, 12.0 / randSpeed, 10.0 * randSpeed, 10.0 * randSpeed);
GetMousePos(X, Y);
MMouse(eX, eY, ranX, ranY);
MouseSpeed := A;
end;
procedure BrakeWindMouse(xs, ys, xe, ye, gravity, wind, minWait, maxWait, targetArea: extended);
var
veloX,veloY,windX,windY,veloMag,dist,randomDist,la stDist: extended;
lastX,lastY,MSP,W,maxStep,D: integer;
sqrt2,sqrt3,sqrt5: extended;
begin
MSP := MouseSpeed;
sqrt2:= sqrt(2);
sqrt3:= sqrt(3);
sqrt5:= sqrt(5);

repeat
dist:= hypot(xs - xe, ys - ye);
wind:= minE(wind, dist);
D := Random((Round(dist)/3));
if (D > 100) then
D := RandomRange(90, 100);
if (D < 5) then
D := RandomRange(5, 8);

maxStep := D;

if dist >= targetArea then
begin
windX:= windX / sqrt3 + (random(round(wind) * 2 + 1) - wind) / sqrt5;
windY:= windY / sqrt3 + (random(round(wind) * 2 + 1) - wind) / sqrt5;
end else
begin
windX:= windX / sqrt2;
windY:= windY / sqrt2;
end;

veloX:= veloX + windX;
veloY:= veloY + windY;
veloX:= veloX + gravity * (xe - xs) / dist;
veloY:= veloY + gravity * (ye - ys) / dist;

if hypot(veloX, veloY) > maxStep then
begin
randomDist:= maxStep / 2.0 + random(round(maxStep) div 2);
veloMag:= sqrt(veloX * veloX + veloY * veloY);
veloX:= (veloX / veloMag) * randomDist;
veloY:= (veloY / veloMag) * randomDist;
end;

lastX:= Round(xs);
lastY:= Round(ys);
xs:= xs + veloX;
ys:= ys + veloY;

if (lastX <> Round(xs)) or (lastY <> Round(ys)) then
MoveMouse(Round(xs), Round(ys));

W := (Random(100/MSP))*3;
if (W < 5) then
W := 5;
wait(W);
lastdist:= dist;
until(hypot(xs - xe, ys - ye) < 1)

if (Round(xe) <> Round(xs)) or (Round(ye) <> Round(ys)) then
MoveMouse(Round(xe), Round(ye));

MouseSpeed := MSP;
end;
procedure BrakeMMouse(eX, eY, ranX, ranY: Integer);
var
randSpeed: extended;
X,Y: integer;
begin
randSpeed := (random(MouseSpeed) / 2.0 + MouseSpeed) / 10.0;
GetMousePos(X, Y);
BrakeWindMouse(X, Y, eX, eY, 9, 5, 10.0 / randSpeed, 15.0 / randSpeed, 10.0 * randSpeed);
end;
Procedure Bank;
begin
if Not(FindNormalRandoms) then
repeat
OpenBankChest(SRL_BANK_SW);
wait(1);
Until (BankScreen);
If (InvCount > 0) then
//repeat
begin
HumanMMouse(370, 310, 4, 4)
ClickMouse2(true);
//repeat (wait(1)) until InvEmpty;
end;
//until (InvEmpty);
If (CurrentBankTab <> WhichBankTab) then
repeat
BankTab(WhichBankTab);
until (BankTab(WhichBankTab));
if (FindBitMapToleranceIn(Kit, X, Y, MSX1, MSY1, MSX2, MSY2, 55)) then
begin
repeat
HumanMMouse(X, Y, 4, 4);
ClickMouse2(False);
If (ChooseOption('Withdraw-4')) then
break;
if Not(ChooseOption('Withdraw-4')) then
repeat
HumanMMouse(X, Y, 4, 4);
ClickMouse2(False);
ChooseOption('Withdraw-X');
Wait(1000 + Random(250));
Typesend('4');
Wait(1500 + Random(125));
until (InvCount = 4);
until (InvCount > 0);
CloseBank;
end else
if Not(FindBitMapToleranceIn(Kit, X, Y, MSX1, MSY1, MSX2, MSY2, 55)) then
begin
writeLn('No kits to open');
Wait(750 + Random(250));
CloseBank;
LogOut;
TerminateScript;
end;
end;
Procedure OpenKits;
begin
if not(findNormalRandoms) then
repeat
wait(1);
until (FindBitmapToleranceIn(Kit, X, Y, MIX1, MIY1, MIX2, MIY2, 55));
begin
HumanMMouse(x, y, 4, 4);
ClickMouse2(True);
Wait(250 + Random(100));
Wait(Random(50));
Mouse(620, 230, 7, 7, Mouse_left);
Wait(Random(50));
Mouse(663, 231, 7, 7, Mouse_left);
Wait(Random(50));
Mouse(706, 232, 7, 7, Mouse_left);
Wait(Random(350));
end;
end;
Procedure Proggy;
begin
Kits := Kits + 4
Profit := Profit + (4*295)
WriteLn('[=============Sokkr7''s Hunter Kit Opener================]');
WriteLn('[' + IntToStr(Kits) + (' hunter kits opened!' + ']'));
WriteLn('[' + ('Player has Made ' + IntToStr(Profit) + (' GP' + ']')));
WriteLn('[' + ('Running for ' + (TimeRunning) +']'));
WriteLn('[================================================== =====]');
end;

begin
//Smart_Server := 85; //0 for random - note it will crash smart each time you stop & start script
//Smart_Members := True;
//Smart_Signed := True;
//Smart_SuperDetail := False;

ClearDebug;
SetupSRL;
CallThings;
ClearDebug;
DeclarePlayers;
repeat
Loginplayer;
until (LoggedIn)
if (LoggedIn) then
SetAngle(SRL_ANGLE_HIGH);
MouseSpeed:= 60; //higher or lower this if you want
Repeat
Bank;
OpenKits;
ClearDebug;
Proggy;
Until(Kits >= AmountOfKits)
Logout;
FreeThings;
TerminateScript;
end.



Edit: I tried running S1N's kit opener and it gave the same results.

riwu
08-21-2012, 06:09 AM
The script ended prematurely? FreeBitmap is only called after you made 50000 kits so i guess it probably ended earlier than that due to out of supply or sth?

anuparockz
08-21-2012, 06:24 AM
got 114k hunter kits. No way I'll run out.

riwu
08-21-2012, 06:34 AM
The script could end at many places, just looking at the first procedure:
if Not(FindNormalRandoms) then
repeat
OpenBankChest(SRL_BANK_SW);
wait(1);
Until (BankScreen);
This means that if random is found (spin tickets will return true too), the script will never open the bank so there will probably be a lot errors. Quite a few logical errors in the script but this is not the place to discuss. Report ur problem in detail to the scripter and use another script.

anuparockz
08-21-2012, 06:50 AM
But could it be a non-script error? I got this error in 2 scripts now.

riwu
08-21-2012, 06:56 AM
Did the script stop itself and this error was shown?

Or u stopped the script manually? if you stopped it manually then it's fine, you can just restart the script.

anuparockz
08-21-2012, 07:13 AM
No the script(s) stop itself. Is there anyone else who is experiencing this error?

P1ng
08-21-2012, 07:37 AM
This error is encountered whenever a DTM or Bitmap is not freed in a script.
Possible causes:

1. User forces termination of the script.
2. Script is not written to handle unexpected termination.

Put AddOnTerminate('FreeThings');
straight after SetupSRL; in the mainloop and this should fix the problem.

anuparockz
08-21-2012, 07:41 AM
Trying what P1NG said. I'll let you know if it works.

riwu
08-21-2012, 07:50 AM
If the script stopped prematurely, freeing the bitmap isn't going to stop that from happening. Bitmaps not being freed is the result, not the cause of the script termination. (unless the script stopped due to excessive memory leak)

P1ng
08-21-2012, 07:53 AM
Was just suggesting it as a method to stop the error, wasn't suggesting it would fix the script ;)