yes, it is way to centralised…
Edit: Working on a way which takes into account the starting mouse position
and here it is… sort of…
function DeterminePoint(StartingPoint: TPoint; Box: TBox): TPoint;
var
MidPoint, Tmp: TPoint;
begin
MidPoint := Point((Box.x1 + Box.x2) / 2, (Box.y1 + Box.y2) / 2);
if StartingPoint.x < Box.x1 then
Tmp.x := RandomRange(Box.x1, MidPoint.x) else
if StartingPoint.x > Box.x2 then
Tmp.x := RandomRange(Box.x2, MidPoint.x) else
Tmp.x := RandomRange(StartingPoint.x, MidPoint.x);
if StartingPoint.y < Box.y1 then
Tmp.y := RandomRange(Box.y1, MidPoint.y) else
if StartingPoint.y > Box.y2 then
Tmp.y := RandomRange(Box.y2, MidPoint.y) else
Tmp.y := RandomRange(StartingPoint.y, MidPoint.y);
Result.x := Tmp.x - Min(Random(Tmp.x - Box.x1), Random(Tmp.x - Box.x1)) + Min(Random(Box.x2 - Tmp.x), Random(Box.x2 - Tmp.x));
Result.y := Tmp.y - Min(Random(Tmp.y - Box.y1), Random(Tmp.y - Box.y1)) + Min(Random(Box.y2 - Tmp.y), Random(Box.y2 - Tmp.y));
end;
It currently spits out a TPoint, cause I was testing where it clicked, however it will use Mouse, if used.
This takes two inputs, StartingPoint, where the mouse STARTS from, when you click a button, you tend to click on the side of the button your mouse is closest to….
the second, Box, is the area you wish to click in…