SRL Archive - Help and Support

Weird Exception


kitchenrange

2012-02-20 22:23:31

For some reason pixelshiftmulti is throwing an exception at weird times.

This is the function I'm calling… extremely simple.

function findStackDTM() : TPoint;
var
itemDTM,x,y: integer;
box: tBox;
begin
itemDTM := DTMFromString('mggAAAHicY2NgYNBlZGDQA2JTIDYEYk0gVgPidUC5FUC8Cog3AvEWIF4LxD3u2gxTvfUYJnrqMvR76DA0O2mAxcyBctgwIxJmQGMzMAAAxr8Mfw==');
if findDTM(itemDTM,x,y,msX1,msY1,msX2,msY2) then
begin
box := intToBox(x-5,y-5,x+5,x+5);
if box.x1 < 1 then exit;
if averagepixelShift(box,50,50) < 1 then result := Point(x,y);
end;
freeDTM(itemDTM);
end;

This is another function I'm using that works fine…

procedure printPixelShiftMouse();
var
x,y: integer;
box: tBox;
begin
getMousePos(x,y);
if (x < 0) or (y < 0) then exit;
box := intToBox(x-14,y-14,x+14,y+14);
if box.x1 < 1 then exit;
WriteLn('PS: ' + intToSTr(pixelShift(box,50)));
end;

And, finally, the error that it is throwing. It is coming from animation.simba.
Error: Exception: You are accessing an invalid point, (0,0) at bitmap[3] at line 46

If I have what I know to be a matching DTM on the screen it works perfectly. If not, (which seems contrary to the logic I used) it will attempt to use pixelshiftmulti and throw the exception.