SRL Archive - OSR Help

Any idea why I keep getting this error?


Cage

2013-09-28 17:27:19

procedure GetClayFromBank;

begin
if bankscreen then
begin
WriteLn('found bankscreen');
if finddtm(CLAYDTM, x, y, MSX1, MSY1, MSX2, MSY2) then
begin
AL_MissMouse(Point(X, Y), 2, 2);
sleep(180 + random(220));
if IsUpText('oft') then
begin
Writeln('Taking Clay');
AL_FastClick(mouse_right);
sleep(212 + random(159));
chooseoption('Withdraw-All');
FreeDTM(CLAYDTM);
closebank;
sleep(215 + random(242));
findnoninventoryrandoms();
end
end
end
end;




Error: Exception: The given DTM Index[1] doesn't exist at line 235


The script finds the DTM perfectly the first time round. However, after a second run, I keep getting this error.


Any advice would be greatly appreciated!

rj

2013-09-28 17:30:25

Because your declaring the DTM and then freeing it, but not declaring it again:

       FreeDTM(CLAYDTM);

Hoodz

2013-09-28 17:34:55

Make a procedure with all your freedtm funtions. After that you should add that procedure on: addonterminate('procedurename ')

Cage

2013-09-28 17:38:55

Thanks a bunch! :)