DeSnob
2010-06-06 15:24:15
As usual.. dumb little Des comes here for help. This time, when trying to create my custom mmouse proc it kept moving the mouse to the same spot it started in! I looked through, adjusted things, deleted things, and switched things around to come to no result. It keeps doing the same thing! Would someone care to look over my code..and see if something is repeated? I've been looking at the same thing all day, so I can't really tell. Thanks!
WARNING: Messy and noobish coding up ahead!
WARNING: Messy and noobish coding up ahead!
procedure DMMouse(x, y: integer; speedmin, speedmax: Extended);
var
cx, cy, i: integer;
wind: Extended;
x1, x2, x3, dx: integer; //dx = distance from position to destination.
y3, dy: integer;//dy = same as above.
a, b, c: integer;//a, b, c are used to make a 15% chance of "messing" up
Moved: integer;//Counts how many times it has "moved".
begin
if speedmax = 0 then
speedmax := 0.01;
GetMousePos(cx, cy);
dx := x - cx;
if dx < 0 then
dx := cx - x;
dy := y - cy;
if dy < 0 then
dy := cy - y;
x1 := x/y;
x2 := Round(x1);
wind := 5.0;
Moved := 1;
for i:= 0 to 3 do
begin
case (Moved) of
0 :
begin
x3 := (x2*dx)/16 + cx/x2+random(10);
y3 := (x2*dy)/16 + cy/x2+random(10);
end;
1 :
begin
x3 := (x2*dx)/8 + cx/x2+random(10);
y3 := (x2*dy)/8 + cy/x2+random(10);
end;
2 :
begin
x3 := (x2*dx)/4 + cx/x2+random(10);
y3 := (x2*dy)/4 + cy/x2+random(10);
end;
3 :
begin
x3 := (x2*dx)/2 + cx/x2+random(10);
y3 := (x2*dy)/2 + cy/x2+random(10);
end;
4 :
begin
x3 := (x2*dx) + cx/x2+random(10);
y3 := (x2*dy) + cy/x2+random(10);
end;
end;
a := 0+random(150);
b := 0+random(100);
c := a / b;
if a = 0 then a := 1;
Inc(Moved);
if c < 30 then
begin
WindMouse(cx, cy, x3+random(7), y3+random(5), 9.0, wind, speedmax+random(1), speedmin+random(3), 2, 10.0);
end else
if c > 30 then
begin
if c < 40 then
begin
wind := wind + 6.0;
WindMouse(cx, cy, x3, y3, 9.0, wind, speedmax, speedmin, 2, 10.0);
end else
WindMouse(cx, cy, x3, y3, 9.0, wind, speedmax, speedmin, 2, 10.0);
end else
WindMouse(cx, cy, x3, y3, 9.0, wind, speedmax, speedmin, 2, 10.0);
end;
end;