Log in

View Full Version : DTM error?



bas
04-22-2012, 01:11 AM
Hello, im making my first RS script with Simba.
Im using DTM's.

Getting error:

Waiting 10 Seconds before starting...
Selected Superheat > NEXT
Superheating > Gold Ore.
Error: Exception: The given DTM Index[3] doesn't exist at line 44
The following DTMs were not freed: [SRL - Lamp bitmap, 1]
The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap]

It superheat 1 time and then it throws the error.

Any help?? :P

Thanks!
Script:

Program SuperHeater;
{$Define SMART}
{$Include SRL/SRL/Misc/SMART.simba}
{$i SRL/SRL.simba}



Var
GoldOre:integer;
CastSuperHeat:integer;
X,y:integer;

Procedure DeclarePlayers;
Begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

Players[0].Name := ''; //Username
Players[0].Pass := ''; //Password
Players[0].Active := True;
Players[0].BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];
LampSkill := 'Magic';
end;

Procedure LoadDTM;
Begin

GoldOre := DTMFromString('mbQAAAHicY2VgYNjExMCwFYg3QDGI3cbIwN ABxE1A3AnELUBsIi/OYKMizaAnI8pgKCsGplmB+tExIxYMBgCZ3ghT');
CastSuperHeat := DTMFromString('mrAAAAHic42BgYGhlYmBoA+JuIG4A4k4oDe I3A3ERIwNDBhAXQ3EZEOdBcSkQv3u9gWGzMBPDoQUCDH8fGjJ8 mM/KYMfEzPCmhpnhy8QsBjmgHfgwIwEMAwC4bxTQ');

end;

procedure Start;
begin
MakeCompass('N')
wait(300);
SetAngle(SRL_ANGLE_HIGH);
wait(300);
end;

Procedure SuperHeat;
Begin
if FindDTM(CastSuperHeat, x, y, MIX1, MIY1, MIX2, MIY2) then
Begin
MMouse(X, Y + 3, 0, 0);

If WaitUptextMulti(['Superheat', 'Item'], 500) Then
Begin
Writeln ('Selected Superheat > NEXT')
ClickMouse2(true);

wait(300);


end;
end;
end;

Procedure Item;
Begin
if FindDTM(GoldOre, x, y, MIX1, MIY1, MIX2, MIY2) then
Begin
MMouse(X, Y + 3, 0, 0);

If WaitUptextMulti(['Superheat', 'Item'], 500) Then
Begin
Writeln ('Superheating > Gold Ore.')
ClickMouse2(true);
wait(600);



end;
end;
end;


Begin
SetupSRL; // MAIN LOOP
ActivateClient;
DeclarePlayers;
LoginPlayer;
LoadDTM; // CALL the loading first

Writeln ('Waiting 10 Seconds before starting...')
wait(10000);
GameTab(Tab_Magic);
wait(400);
Start;
wait(100);

repeat


SuperHeat;
FreeDTM(CastSuperHeat);
Item;
FreeDTM(GoldOre);


//BANKING HERE


until(false);
end.

John
04-22-2012, 05:24 AM
Try taking out 1 or both of the free dtms..

Total
04-22-2012, 05:32 AM
You are Freeing DTMs but not recalling them. You would need to move LoadDTM to inside of your repeat statement if you want to do it like that. Once you free your DTM its gone unless you load it again.

johnbrown8976
05-01-2012, 02:52 AM
Fixed :p
Changes: Moved FreeDTM outside the Repeat loop.


Program SuperHeater;
{$Define SMART}
{$Include SRL/SRL/Misc/SMART.simba}
{$i SRL/SRL.simba}

Var
GoldOre:integer;
CastSuperHeat:integer;
X,y:integer;

Procedure DeclarePlayers;
Begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

Players[0].Name := ''; //Username
Players[0].Pass := ''; //Password
Players[0].Active := True;
Players[0].BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];
LampSkill := 'Magic';
end;

Procedure LoadDTM;
Begin
GoldOre := DTMFromString('mbQAAAHicY2VgYNjExMCwFYg3QDGI3cbIwN ABxE1A3AnELUBsIi/OYKMizaAnI8pgKCsGplmB+tExIxYMBgCZ3ghT');
CastSuperHeat := DTMFromString('mrAAAAHic42BgYGhlYmBoA+JuIG4A4k4oDe I3A3ERIwNDBhAXQ3EZEOdBcSkQv3u9gWGzMBPDoQUCDH8fGjJ8 mM/KYMfEzPCmhpnhy8QsBjmgHfgwIwEMAwC4bxTQ');
end;

procedure Start;
begin
MakeCompass('N')
wait(300);
SetAngle(SRL_ANGLE_HIGH);
wait(300);
end;

Procedure SuperHeat;
Begin
if FindDTM(CastSuperHeat, x, y, MIX1, MIY1, MIX2, MIY2) then
Begin
MMouse(X, Y + 3, 0, 0);
If WaitUptextMulti(['Superheat', 'Item'], 500) Then
Begin
Writeln ('Selected Superheat > NEXT')
ClickMouse2(true);
wait(300+random(50));
end;
end;
end;

Procedure Item;
Begin
if FindDTM(GoldOre, x, y, MIX1, MIY1, MIX2, MIY2) then
Begin
MMouse(X, Y + 3, 0, 0);
If WaitUptextMulti(['Superheat', 'Item'], 500) Then
Begin
Writeln ('Superheating > Gold Ore.')
ClickMouse2(true);
wait(600);
end;
end;
end;

Begin
SetupSRL; // MAIN LOOP
ActivateClient;
DeclarePlayers;
LoginPlayer;
LoadDTM; // CALL the loading first

Writeln ('Waiting 10 Seconds before starting...')
wait(10000);
GameTab(Tab_Magic);
wait(400);
Start;
wait(100);

repeat
SuperHeat;
Item;
//BANKING HERE
until(false);

FreeDTM(CastSuperHeat); //Moved outside the Repeat Loop
FreeDTM(GoldOre); //Moved outside the Repeat Loop
end.