SRL Archive - SRL Archives

FindMiddleBox


n3ss3s

2007-04-28 15:10:47


procedure FindMiddleBox(var x, y: integer; ax, ay, bx, by, cx, cy, dx, dy: integer);
// Auth: n3ss3s usage is self-explanatory
begin
x := (ax + bx + cx + dx) / 4;
y := (ay + by + cy + dy) / 4;
end;
I think it is ultimate useful for a failsafe, for example if your scripts are banking something and youre afraid of that your bitmaps or dtms mix up, you can use this as

if(FindBlaBla)then
begin
blabla;
end
else
begin
FindMiddleBox(x,y,ItemCoords(1).x-4,ItemCoords(1).y-4,ItemCoords(1).x+4,ItemCoords(1).y-4,
ItemCoords(1).x-4,ItemCoords(1).y+4,ItemCoords(1).x+4,ItemCoords(1).y+4);
Mouse(x,y,0,0,false);
SomethingForBanking;
end;
I was too lazy to standardize an example.
I hope you get the idea.