SRL Archive - Bugs

Can't tell if it's Simba or not...


Tim0suprem0

2010-04-24 01:38:21

Error: Exception: Out of memory at line 108
The following DTMs were not freed: [SRL - Lamp bitmap]
The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap]
File[C:\Program Files\Simba\Includes\SRL\Logs\SRL Log 24-04-10 24.txt] has not been freed in the script, freeing it now.

Is this my fault?

i luffs yeww

2010-04-24 03:37:05

No. It's your computer's for sucking.

mastaraymond

2010-04-24 05:00:28

Not sure, probably a Simba fault.. What is the exact line?

Tim0suprem0

2010-04-24 12:00:19

function LoggedIn: Boolean;
var
cx, cy: Integer;
begin
Result := FindColor(cx, cy, 16777215, 439, 491, 440, 492); //line 108 in Players.scar
end;

Which is why it was weird…

Wizzup?

2010-04-24 12:09:30

What script are you running?

Tim0suprem0

2010-04-24 14:57:18

From: Wizzup?
What script are you running?


I'm trying to make a barb village powerfisher :redface:

Here's what I had so far:

program BarbFisher;
//{$Define SMART}
{$IfDef SMART}
{.include SRL/SRL/Misc/Smart.scar}
{$EndIf}
{.include SRL\SRL.scar}

var x,y: integer;

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

With Players[0] do
begin
Name := '';
Pass := '';
Active := True;
Booleans[0] := true; //hatchet equipped or not
end;

end;

Function CheckForStuff : boolean;
var FlyRodDTM, TinderBoxDTM, FeatherDTM: integer;
begin
if (not LoggedIn) then
Exit;

GameTab(tab_Inv);

FlyRodDTM := DTMFromString('78DA6334636660E8616440054C601226CAE80' +
'3545341408D2350CD04026ADC806A9A08A87125AC0600A4C9040F' +
'');

TinderBoxDTM := DTMFromString('78DA63DCCCC4C0F092010D30814946288FF12' +
'0907F9D809A5340FE2D026A4E1361D77E20FF0301359B80FC07F8' +
'D50000C25B09F2');

FeatherDTM := DTMFromString('78DA634C65666098CCC8800A9818E4802448F' +
'43F1030666057C3005503A6416A7A09A8C902AAE923A0261BA8A6' +
'89809A024C351C521CA86A4A816A5A8930A71BBF1A00113F0C37');



Result := (FindDTM(FlyRodDTM,x,y,MIX1,MIY1,MIX2,MIY2) and FindDTM(TinderBoxDTM,x,y,MIX1,MIY1,MIX2,MIY2) and
FindDTM(FeatherDTM,x,y,MIX1,MIY1,MIX2,MIY2));



FreeDTM(FlyRodDTM);
FreeDTM(TinderBoxDTM);
FreeDTM(FeatherDTM);

end;

Function CheckForHatchet : boolean;
var HatchetDTM : integer;
begin
HatchetDTM := DTMFromString('78DA63EC61626078CF800698C0242394C7D80' +
'BE47F20A0A61FC87F4240CD2420FF1901355381FC6B04D4CC07F2' +
'6F10A1E63E0135D380FC3BF8D50000623C0BE6');

if Players[CurrentPlayer].Booleans[0] then
GameTab(tab_Equip)
else
GameTab(tab_Inv);

Result := FindDTM(HatchetDTM,x,y,MIX1,MIY1,MIX2,MIY2);
FreeDTM(HatchetDTM);
end;

begin
SetupSRL;
DeclarePlayers;
LoginPlayer;
SetAngle(True);
if CheckForStuff and CheckForHatchet then
Writeln('everything''s there!')
else
Writeln('nope');
//WalkToSpot;
//FindSpot;
end.

It happened after doing that a bunch of times.

Tim0suprem0

2010-04-24 14:59:41

Also, if I try and find the DTMs consecutively in Simba, many times it misses one or two of the three. However if I try in SCAR it finds all three every time.

I found I could fix this in Simba by adding small waits between each FindDTM procedure.

Wanted

2010-04-24 15:01:44

For future reference it's probably a good idea to adjust your @onterminate by making this

procedure ScriptTerminate;
begin
FreeSRLBitmaps;
end;

that way when ever you use TerminateScript or your script is stopped manually ect.. it will free those.

Wizzup?

2010-04-24 17:09:14

Perhaps you can try loading the DTM's once, at the start of the script, rather than every time? (Perhaps someone the DTM's aren't cleared correctly)

Also, @ not finding DTM's; it should work just fine. And a wait in there really can't make the difference. :confused: They work fine for me.

E: Disregard my previous comment(s). That's pretty weird. Let's see if I/we can reproduce.

From: IceFire908
For future reference it's probably a good idea to adjust your @onterminate by making this

procedure ScriptTerminate;
begin
FreeSRLBitmaps;
end;

that way when ever you use TerminateScript or your script is stopped manually ect.. it will free those.


Simba auto frees the bitmaps. So that's not an issue, only SCAR requires that.