Make sure you are declaring the DTMString globally,
Make sure you are not freeing the DTM before finding it,
Make sure you are not setting the DTM after searching the inventory for it,
Here's a working Example for counting raw sharks;
Simba Code:
program new;
{$i srl/srl.simba}
var
itemDTM1: integer;
procedure SetupGlobals;
begin
itemDTM1 := DTMFromString('mbQAAAHicY2VgYLBjYmBwAWJLILYGYk8gFmZkYOADYkkg5gViESCuq6xgiAwLZYiJiGAIDwlmyEhJYeAH6kfHjFgwGAAA5wkHrA==');
end;
procedure FreeGlobals;
begin
FreeDTM(itemDTM1);
end;
function ReturnInvAmount: Integer;
begin
result := CountItems('dtm', itemDTM1, []);
end;
begin
SetupSRL;
SetupGlobals;
AddOnTerminate('FreeGlobals');
Writeln(ReturnInvAmount);
TerminateScript;
end.
Hope this helps,
Lj