Log in

View Full Version : Simba: DTM error



zeeky111
01-24-2011, 03:48 AM
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('m0gEAAHictc4xCoNQDIDh6OgBXHsJsVCFio pSdRB6B49cikLtIJWiIOgFj98g0NHDXwvCbyE2CISmyIREuQoU OKueyXDDanG8LDBVe4cHCGjwAfdr/xQo0HnmjQoseACTMWXSujrPNfdJs9KlfeidfYnSXHxP6Xrv7HD 3ONGqw=');
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
01-24-2011, 03:54 AM
You have lobdtm as global variable, instead change it to a local one

zeeky111
01-24-2011, 03:54 AM
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. :].