Results 1 to 2 of 2

Thread: MMouse's Randomness

  1. #1
    Join Date
    Dec 2006
    Location
    Third rock from the sun.
    Posts
    2,510
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default MMouse's Randomness

    Short question.

    The Randx and Randy in the MMouse procedure-

    If I put in "2, 2" will it create a 2x2 mousebox around the coords I put in?

    Like if I put in "6, 6" will it click on, and 6 coords x and y around the coords I put in?

    Hopefully you understand what I mean

    Thanks!

    Mike.

  2. #2
    Join Date
    Sep 2006
    Location
    New Jersey, USA
    Posts
    5,347
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    SCAR Code:
    function MMouse(dx, dy, RandX, RandY: Integer): Boolean;
    var
      Path: TPointArray;
      i, cx, cy, Lx, Ly, xx, yy, Dist, MidRX, MidRY: Integer;
      Step, SlowDown: Extended;
    begin
      Result := True;
      if (BenMouse) then
      begin
        try
          MidRX := Round(RandX / 2);
          MidRY := Round(RandY / 2);
          dx := dx + MidRX + NormDist(MidRX);
          dy := dy + MidRY + NormDist(MidRY);
          if dx < 0 then dx := 0;
          if dy < 0 then dy := 0;
          GetMousePos(cx, cy)
            if not ((Cx - dx = 0) and (Cy - dy = 0)) then
          begin
            Path := MakeMouseSplinePath(cx, cy, dx, dy, 7, 50, 40);
            Lx := cx;
            Ly := cy;
            for i := 0 to GetArrayLength(Path) - 1 do
            begin
              MoveMouse(Path[i].x, Path[i].y);
              Dist := Round(Sqrt((Path[i].x - dx) * (Path[i].x - dx) + (Path[i].y -
                dy) * (Path[i].y - dy)));
              if Dist < 50 then
              begin
                SlowDown := SlowDown + (0.05 * MouseSpeed);
              end;
              Wait(Round(((Random(2) + MouseSpeed) / 10) * Sqrt(Sqr(Path[i].x - Lx)
                + Sqr(Path[i].y - Ly)) + SlowDown));
              Lx := Path[i].x;
              Ly := Path[i].y;
            end;
          end;
          MoveMouseSmooth(dx, dy);
        except
          WriteLn('Error in BenMouse');
          WriteLn('Report: ' + IntToStr(cx) + ', ' + IntToStr(cy) + ' : ' +
            IntToStr(dx) + ', ' + IntToStr(dy) + ' : ' + IntToStr(mousespeed) +
              ';');
        end;
      end else
      begin // Start Mutant/RsN MMouse
        step := 4;
        xx := NormDist(RandX);
        yy := NormDist(RandY);
        dx := dx + xx;
        dy := dy + yy;
        GetMousePos(x, y);
        repeat
          if (Distance(x, y, dx, dy) < 100) then
            if (not (Distance(x, y, dx, dy) = 0)) then
              step := step - (10 / Distance(x, y, dx, dy));
          if (step < 1) then
            step := 1;
          x := x + Round((dx - x) / step);
          y := y + Round((dy - y) / step);
          MoveMouse(x, y);
          Wait(MouseSpeed);
        until (Distance(x, y, dx, dy) = 0);
      end;
    end;

    Short answer: yes

    Long answer: no, but what it does is essentially the same thing

    Explanation: It will make a box around the point you want to click. The box's size is dependent upon the randomness you set. The function will then move the mouse to a random point inside the box.

    [I used MMouse as an example because it's simpler than, but does the same thing as Mouse (as far as mouse movement is concerned)]
    Interested in C# and Electrical Engineering? This might interest you.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •