SRL Archive - Help and Support

FindDTM error


rogeruk

2007-09-02 10:53:23

Im using this code that was posted in the snippets section..
function CountItemDTMA(DTM: Integer): Integer;//Based off of the
var //one in srl for bmps
i, x, y: Integer;
TB: Tbox;
begin
if not LoggedIn then Exit;
GameTab(4);
for i := 1 to 28 do
begin
TB := InvBox(i);
if ExistsItem(i) then
if FindDTM(DTM, x, y, TB.x1, TB.y1, TB.x2, TB.y2) then
Inc(Result);
end;
end;

Currently im using it as


oaklogdtm := DTMFromString('78DA63CC65626078CA80028AC24D187418191' +
'88088E13F10302601D5DC6540038C4824902E03AAB945404D3250' +
'CD5B026AAA806A5EE1570300B1680BD4');
aoaklogs:=CountItemDTMA(oaklogdtm);

I get the error
[Runtime Error] : Exception: Access violation at address 006FFBEA in module 'scar.exe'. Read of address 00000000 in line 149 in script C:\Program Files\SCAR 3.11\Scripts\OakBanker2.5.scar


Line 149 is..
if FindDTM(DTM, x, y, TB.x1, TB.y1, TB.x2, TB.y2) then

Any ideas please?

IronTeapot

2007-09-02 11:59:53

for the "Access violation" try saving your work, and then close scar, (make sure its closed in task manager too), and repoen scar.

and findDTM can use tpoint variables?

rogeruk

2007-09-02 12:28:17

I tried what you said, but problem still comes back.

I re-made the DTM and it seems to have fixed the problem.

Thanks for help

n3ss3s

2007-09-02 12:28:21

Yes it can because TPoint.x is an integer, and so is y

And try making a new variable like "TheDTM: Integer" and then do "TheDTM := DTM;"

rogeruk

2007-09-02 12:30:50

I have the DTM declared in my BMP procedure which is called at beginning of script, and then the counting procedure is called when in bank.

Think it is sorted. Thanks

The Claw

2007-09-03 04:58:05

Possibly the DTM you made was bigger than the box that you were searching in?