I searched the forums when the moment i heard someone comment about memory leaks. But all i get is other peoples script. I notice alot of scripts get these comments and im wondering... How do you fix Memory Leaks. Because i have a script and sometimes it lags and im wondering if it has memory leaks. Mostly this part of the script lags.
SCAR Code:
function BurnMaples : Boolean;
var
FailedToLight, TinderBoxDTM, MapleDTM, tx, ty, mx, my : Integer;
begin
if (not (InvFull)) or (not (LoggedIn)) then Exit;
SetChat('Off', 1);
if (InvFull) then
begin
TinderBoxDTM := DTMFromString('78DA637466626078CA8002DCED38191E02694' +
'620FE0F048CF64035B718D000231209A4CD806A9E1050630D54F3' +
'81801A5FA09AD744A8B9835F0D003B9A0C70');
MapleDTM := DTMFromString('78DA63CC65626078C28002929D79181E02694' +
'620FE0F048C794035B719D000231209A4E330CDC150930654F391' +
'809A12A09AB704D49401D53CC2AF0600D5820D99');
repeat
if (AntiRandoms(True)) then
Wait(750 + Random(450));
FindDTM(TinderBoxDTM, tx, ty, MIX1,MIY1,MIX2,MIY2);
Mouse(tx, ty, 2, 2, True);
Wait(480 + Random(110));
FindDTM(MapleDTM, mx, my, MIX1, MIY1, MIX2, MIY2);
Wait(500 + Random(440));
Mouse(mx, my, 2, 2, True);
if (CantLightCheck) then
begin
Writeln('Player can not light a fire in its current spot.');
Mouse(MSCX+25, MSCY+25, 5, 5, True);
Wait(335 + Random(110));
FFlag(1);
FailedToLight := FailedToLight + 1;
if (FailedToLight = 5) then
begin
LogOut;
Writeln('Player is having difficulties lighting a fire.');
end;
end;
LightWait;
Wait(660 + Random(410));
until (not (ExistsItem(28)));
end;
LoadsDone := LoadsDone + 1;
Total := Total + 1;
Burned := Burned + 1;
FreeDTM(TinderBoxDTM);
FreeDTM(MapleDTM);
Result := True;
Wait(250 + Random(300));
SetChat('On', 1);
end;
SCAR Code:
function FindMaples : Boolean;
var
MapleTPA : TPointArray;
MapleATPA : T2DPointArray;
I, CTS, mx, my : Integer;
MouseOnMaple : Boolean;
begin
if (not (LoggedIn)) or (InvFull) or (Slot28(True)) then Exit;
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
FindColorsSpiralTolerance(MSCX, MMCY, MapleTPA, 2505573, MSX1, MSY1, MSX2, MSY2, 15);
if (Length(MapleTPA) < 1) then Exit;
MapleATPA := SplitTPA(MapleTPA, 15);
for I := 0 To High(MapleATPA) do
If MiddleTPAEX(MapleATPA[i], mx, my) then
begin
MMouse(mx, my, 3, 3);
Wait(715 + Random(100));
if (IsUpText('aple')) then
begin
Mouse(mx, my, 0, 0, True);
FFlag(0);
Wait(1500 + Random(910));
MMouse(MSCX, MSCY, 5, 5);
FindColorSpiralTolerance(mx, my, 2505573, MSX1, MSY1, MSX2, MSY2, 15);
MMouse(mx, my, 0, 0);
MapleEnt;
Wait(200 + Random(115));
if (not (IsUpText('aple'))) then
begin
MouseOnMaple := False;
Wait(440 + Random(225));
FindColorSpiralTolerance(mx, my, 2505573, MSX1, MSY1, MSX2, MSY2, 15);
MMouse(mx, my, 2, 2);
if (IsUpText('aple')) then
begin
Mouse(mx, my, 2, 2, True);
end;
FFlag(0);
MapleEnt;
Wait(315 + Random(110));
end;
repeat
if (AntiRandoms(True)) then
begin
Mouse(mx, my, 0, 0, True);
RandomsSolved := RandomsSolved + 1;
end;
Wait(315 + Random(115));
MMouse(mx, my, 2, 2);
Wait(690 + Random(110));
case (Random(4)) of
2: Mouse(mx, my, 2, 2, True);
end;
AntiBan;
until (InvFull) or (Slot28(True)) or (not (IsUpText('aple')))
Result := True;
end else
begin
Result := False;
Exit;
end;
end;
end;
and this part seems to lag alot, so can anyone help me please? Thanks