Log in

View Full Version : The following DTMs were not freed: [2]



Omenga
09-02-2012, 08:21 PM
My script says "The following DTMs were not freed: [2]" after it compiles and I have tried so many times to figure it out, I know it must be a simple mistake because I am knew to this but could someone please look over it.

program Choose;
{$i srl/srl.simba}
var
x, y, i: Integer;
Q: Array [0..7] of Integer;

procedure FindBob;
var
x, y:Integer;

begin
MoveMouse(308, 163);
wait(200);
ClickMouse(308, 163, 0);
wait(300);
end;


procedure SetDTM;
begin
Q[2] := DTMFromString('mggAAAHicY2NgYPBhYmDQBmI9II4A4gwgTg FiRUYGBmkgVoFiBSj/2I6pcPz/PwMc4wKMODAEAABTTw7a');
end;

function FrDTM:Boolean;
begin
FreeDTM(Q[2]);
end;


function TradeBob:Boolean;
var
x, y, Bob: Integer;
begin
wait(2000);
SetupSRL;
Bob := DTMFromString('mggAAAHicY2NgYPBhYmDQBmI9II4A4gwgTg FiRUYGBmkgVoFiBSj/2I6pcPz/PwMc4wKMODAEAABTTw7a');
if FindDTM(Bob, x, y, 555, 281, 623, 293) Then
begin
Mouse(x, y, 4, 4, False);
ChooseOption('Trade');
Writeln('We Found Bob!');
end;
end;

begin
FindBob;
SetDTM;
FrDTM;
TradeBob;
end.

CephaXz
09-02-2012, 08:29 PM
You didn't free Bob?

Le Jingle
09-02-2012, 08:35 PM
Don't know what you need this for exactly, but it seemed RS-related so I changed out some bad/high ban rate mouse/click proc's. I also added in some wait times relative to the function, given their simplicity. There was also no need to declare q as an array of integer and only use it for one dtm. Also, SetupSRL is good to call at the beginning of your main loop (begin / end.) plus you didn't free the Bob DTM, and never used the Q dtm.


program Choose;
{$i srl/srl.simba}

var
bob: integer;

procedure FindBob;
begin
MMouse(308, 163, 0, 0);
wait(200);
ClickMouse2(mouse_left);
wait(300);
end;

procedure SetupDTMs;
begin
Bob := DTMFromString('mggAAAHicY2NgYPBhYmDQBmI9II4A4gwgTg FiRUYGBmkgVoFiBSj/2I6pcPz/PwMc4wKMODAEAABTTw7a');
end;

procedure FrDTMs;
begin
FreeDTM(bob);
end;

function TradeBob: Boolean;
var
x, y: Integer;
begin
result := false;
if FindDTM(Bob, x, y, 555, 281, 623, 293) then
begin
Mouse(x, y, 4, 4, False);
if WaitOption('Trade', 1000) then
result := true;
end;
end;

begin
SetupSRL;
SetupDTMs;
AddOnTerminate('FrDTMs');
FindBob;
WaitFunc(@TradeBob, 250, 2500);
end.


Edit : I see q and Bob were the same dtm, so I removed q. I also removed the space in your dtm.

Omenga
09-02-2012, 08:37 PM
oh, is it just:

procedure FrDTM;
begin
FreeDTM(Bob);
end;

?

Omenga
09-02-2012, 08:38 PM
oh thanks Le Jingle! :D

litoris
09-02-2012, 08:44 PM
Dude, it's because you broke the space-bot continuum. You need to go back in time and fix whatever you broke with that DTM.

Omenga
09-02-2012, 08:45 PM
What I wanted it to do was move mouse over bob, right-click, then find the DTM for the trade option. :/

Omenga
09-02-2012, 08:51 PM
With Le Jingles Code I get:

The following DTMs were not freed: [SRL - Lamp bitmap, 1, 2, 3]
The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, SRL - NavBar Bitmap]
[Hint] C:\Simba\Includes\SRL/SRL/core/antirandoms\randomtool.simba(215:3): Variable 'T' never used at line 214
Compiled successfully in 2559 ms.
SRL Compiled in 15 msec
Error: Exception: FindDTMs: DTM[] is not valid. at line 32
The following DTMs were not freed: [SRL - Lamp bitmap, 1, 2, 3]
The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, SRL - NavBar Bitmap]

This stuff is confusing.

Olly
09-02-2012, 09:01 PM
begin
SetupSRL;
SetupDTMs;
FindBob;
WaitFunc(@TradeBob, 250, 2500);
FrDTMs
end.

Try that.