SRL Archive - Help

Simba: DTM error


zeeky111

2011-01-23 22:48:17

The following is a little program that I'm hoping to (eventually) integrate into a script that cooks lobsters at Al Kharid.

I just started working on this, and it's my first script that actually relies on a DTM for to work.

program FindLobsters;

var
lobdtm, x, y, ax, ay, bx, by: integer;
FLResult: boolean;
procedure FLSetVars;
begin
ax := 555;
ay := 212;
bx := 730;
by := 459;
end;
procedure FLDefineDTM;
begin
lobdtm := DTMFromString('m0gEAAHictc4xCoNQDIDh6OgBXHsJsVCFiopSdRB6B49cikLtIJWiIOgFj98g0NHDXwvCbyE2CISmyIREuQoUOKueyXDDanG8LDBVe4cHCGjwAfdr/xQo0HnmjQoseACTMWXSujrPNfdJs9KlfeidfYnSXHxP6Xrv7HD3ONGqw=');
end;
function FLFindLobster: Boolean;
begin
if (FindDTM(lobdtm, x, y, ax, ay, bx, by)) then
begin
Result := True;
end else
Result := False;
end;
procedure FLSetResult;
begin
if (FLFindLobster) then
begin
FLResult := True
end else
FLResult := False;
Writeln('Raw Lobster DTM not found.');
end;
begin
FLSetVars;
FLDefineDTM;
FLSetResult;
Writeln('FLFindLobster returned '+BoolToStr(FLResult)+'.');
end.
Line 19 returns the following exception:
Error: Exception: FindDTMs: DTM[] is not valid. at line 19
To save you time, line 19 is:
if (FindDTM(lobdtm, x, y, ax, ay, bx, by)) then
What am I doing wrong? :[.

Thanks.

EDIT: Yeah, and I realize that functions return false by default. I put "Result := False" in there because I want to. o.o.

KingKong

2011-01-23 22:54:18

You have lobdtm as global variable, instead change it to a local one

zeeky111

2011-01-23 22:54:38

From: KongKing
You have lobdtm as global variable, instead change it to a local one


Alright, thanks. :].

EDIT2: Never mind. I fixed it using a local var. Thanks Kong. :].