Results 1 to 4 of 4

Thread: mouse function

  1. #1
    Join Date
    Nov 2018
    Posts
    4
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default mouse function

    where can I find a decent mouse function?

    srl include doesnt work for me, and only mouse function I can find in the includes is the human wind mouse which moves nothing like a human, and the brake wind mouse, which works pretty good except for the fact it likes to circle around in on-itself for eternity on more than a rare ocasion, i keep seeing people mention MMouse but i cant find it anywhere

  2. #2
    Join Date
    Jan 2012
    Location
    Sydney, Australia
    Posts
    877
    Mentioned
    12 Post(s)
    Quoted
    368 Post(s)

    Default

    Aerolib had a few good mouse functions that seem to work well, would be worth investigating. Should be able to have the functions in your script without having to use it as well.

    AeroLib\core\engine\InputHandler.Simba

    Simba Code:
    {
    ============
    InputHandler
    ============
    }


    var
      MouseSpeed: Integer;

    procedure getRealMousePos(var X, Y : Integer);
    var
      KMTarget, ITarget: Integer;
    begin
      {$IFDEF SMART}
        if not IsTargetValid() then Writeln('Target invalid');
        KMTarget := GetKeyMouseTarget;
        ITarget := GetImageTarget;
        if not findAndSetTarget('SMART', True) then
          findAndSetTarget('Old', True);

        GetMousePos(X, Y);
        FreeTarget(GetImageTarget);
        SetKeyMouseTarget(KMTarget);
        SetImageTarget(ITarget);

        X := X - 3;
        Y := Y - 25;
      {$ELSE}
        GetMousePos(X, Y);
      {$ENDIF}
    end;

    function getRealMousePnt(): TPoint;
    var
      x,y : integer;
    begin
      getRealMousePos(X, Y);
      Result := Point(X, Y);
    end;

    function getMousePnt(): TPoint;
    var
      x,y : integer;
    begin
      getMousePos(X, Y);
      Result := Point(X, Y);
    end;

    function isMouseInClient(): Boolean;
    begin
      result := pointInBox(getRealMousePnt(), toBox(MSX1,MSY1,MIX2,MIY2));
    end;

    {*******************************************************************************
    procedure Procedure brakeWindMouse(xs, ys, xe, ye, gravity, wind,
      targetArea: extended; reverse: boolean);
    By: Flight
    Description: Mouse movement based on distance to determine speed. Default slowed
                 speed at 20% from destination, if Double is set to true then slowed
                 speed also starts at origin and ends 80% to destination.
    *******************************************************************************}

    Procedure brakeWindMouse(xs, ys, xe, ye, gravity, wind, targetArea: extended; double: boolean);
    var
      T : Timer;
      veloX,veloY,windX,windY,veloMag,dist,randomDist,lastDist,D: extended;
      lastX,lastY,MSP,W,TDist: integer;
      sqrt2,sqrt3,sqrt5,PDist,maxStep,dModA,dModB,nModA,nModB: extended;
    begin
      MSP  := MouseSpeed;
      sqrt2:= sqrt(2);
      sqrt3:= sqrt(3);
      sqrt5:= sqrt(5);

      TDist := Distance(Round(xs), Round(ys), Round(xe), Round(ye));
      if (TDist < 1) then
        TDist := 1;

      dModA := 0.88;
      dModB := 0.95;

      if (TDist > 220) then
      begin
        nModA := 0.08;
        nModB := 0.04;
      end else if (TDist <= 220) then
      begin
        nModA := 0.20;
        nModB := 0.10;
      end;

      T.start();
      repeat
        if (T.timeElapsed() > 5000) then
          break;

        dist:= hypot(xs - xe, ys - ye);
        wind:= minE(wind, dist);
        if (dist < 1) then
          dist := 1;
        PDist := (dist/TDist);
        if (PDist < 0.01) then
          PDist := 0.01;

        if Double then
        begin
          if (PDist <= dModA) then
          begin
            D := (Round((Round(dist)*0.3))/5);
            if (D < 20) then
              D := 20;

          end else if (PDist > dModA) then
          begin
            if (PDist < dModB) then
              D := RandomRange(5, 8)
            else if (PDist >= dModB) then
              D := RandomRange(3, 4);
          end;
        end;

        if (PDist >= nModA) then
        begin
          D := (Round((Round(dist)*0.3))/5);
          if (D < 20) then
            D := 20;
        end else if (PDist < nModA) then
        begin
          if (PDist >= nModB) then
            D := RandomRange(5, 8)
          else if (PDist < nModB) then
            D := RandomRange(3, 4);
        end;

        if (D <= Round(dist)) then
          maxStep := D
        else
          maxStep := Round(dist);

        if dist >= targetArea then
        begin
          windX:= windX / sqrt3 + (random(round(wind) * 2 + 1) - wind) / sqrt5;
          windY:= windY / sqrt3 + (random(round(wind) * 2 + 1) - wind) / sqrt5;
        end else
        begin
          windX:= windX / sqrt2;
          windY:= windY / sqrt2;
        end;

        veloX:= veloX + windX;
        veloY:= veloY + windY;
        veloX:= veloX + gravity * (xe - xs) / dist;
        veloY:= veloY + gravity * (ye - ys) / dist;

        if (hypot(veloX, veloY) > maxStep) then
        begin
          randomDist:= maxStep / 2.0 + random(round(maxStep) div 2);
          veloMag:= sqrt(veloX * veloX + veloY * veloY);
          veloX:= (veloX / veloMag) * randomDist;
          veloY:= (veloY / veloMag) * randomDist;
        end;

        lastX:= Round(xs);
        lastY:= Round(ys);
        xs:= xs + veloX;
        ys:= ys + veloY;

        if (lastX <> Round(xs)) or (lastY <> Round(ys)) then
          moveMouse(Round(xs), Round(ys));

        W := (Random((Round(100/MSP)))*6);
        W := max(W, 5);
        if Double then
        begin
          if (PDist > dModA) then
            W := Round(W*2.5);
        end else
          W := Round(W*1.2);
        wait(W);
        lastdist:= dist;
      until(hypot(xs - xe, ys - ye) < 1)

      if (Round(xe) <> Round(xs)) or (Round(ye) <> Round(ys)) then
        MoveMouse(Round(xe), Round(ye));

      MouseSpeed := MSP;
    end;

    function isUptextMulti(Text: TStringArray): Boolean; forward;
    {*******************************************************************************
    Function humanWindMouse(xs, ys, xe, ye, gravity, wind,
      targetArea: extended): Boolean;
    By: Flight
    Description: ....
    *******************************************************************************}

    Function humanWindMouse(xs, ys, xe, ye, gravity, wind, targetArea: extended; TxtArr: TStringArray = []): Boolean;
    var
      T : Timer;
      veloX,veloY,windX,windY,veloMag,dist,randomDist,lastDist,D: extended;
      lastX,lastY,MSP,W,TDist: integer;
      sqrt2,sqrt3,sqrt5,maxStep,rCnc: extended;
      txt : TStringArray;
    begin
      Result := False;
      MSP  := MouseSpeed;
      sqrt2:= sqrt(2);
      sqrt3:= sqrt(3);
      sqrt5:= sqrt(5);

      txt := TxtArr;
      TDist := Distance(Round(xs), Round(ys), Round(xe), Round(ye));
      T.start();
      repeat
        if length(txt) > 0 then
          if isUpTextMulti(txt) then
            Exit(true);
        if (T.timeElapsed>10000) then
          break;

        dist:= hypot(xs - xe, ys - ye);
        wind:= minE(wind, dist);
        if (dist < 1) then
          dist := 1;

        D := (Round((Round(TDist)*0.3))/7);
        if (D > 25) then
          D := 25;
        if (D < 5) then
          D := 5;

        rCnc := Random(6);
        if (rCnc = 1) then
          D := RandomRange(2,3);

        if (D <= Round(dist)) then
          maxStep := D
        else
          maxStep := Round(dist);

        if dist >= targetArea then
        begin
          windX:= windX / sqrt3 + (random(round(wind) * 2 + 1) - wind) / sqrt5;
          windY:= windY / sqrt3 + (random(round(wind) * 2 + 1) - wind) / sqrt5;
        end else
        begin
          windX:= windX / sqrt2;
          windY:= windY / sqrt2;
        end;

        veloX:= veloX + windX;
        veloY:= veloY + windY;
        veloX:= veloX + gravity * (xe - xs) / dist;
        veloY:= veloY + gravity * (ye - ys) / dist;

        if (hypot(veloX, veloY) > maxStep) then
        begin
          randomDist:= maxStep / 2.0 + random(round(maxStep) div 2);
          veloMag:= sqrt(veloX * veloX + veloY * veloY);
          veloX:= (veloX / veloMag) * randomDist;
          veloY:= (veloY / veloMag) * randomDist;
        end;

        lastX:= Round(xs);
        lastY:= Round(ys);
        xs:= xs + veloX;
        ys:= ys + veloY;

        if (lastX <> Round(xs)) or (lastY <> Round(ys)) then
          MoveMouse(Round(xs), Round(ys));

        W := (Random((Round(100/MSP)))*6);
        if (W < 5) then
          W := 5;
        if length(txt) >= 1 then
          W := Round(W*0.6) // Speed it up a little for compensation
        else
          W := Round(W*0.9);
        wait(W);
        lastdist:= dist;
      until(hypot(xs - xe, ys - ye) < 1)

      if (Round(xe) <> Round(xs)) or (Round(ye) <> Round(ys)) then
        MoveMouse(Round(xe), Round(ye));
    end;

    function itemsInBank(): Boolean; forward;
    {*******************************************************************************
    Function windMouseFunc(xs, ys, xe, ye, gravity, wind, targetArea: extended;
              Func: function: Boolean): Boolean;
    By: Flight
    Description: "Slowly" moves the mouse until either the target coordinate is
                 reached or the condition 'Func' is met.
    *******************************************************************************}

    Function windMouseFunc(xs, ys, xe, ye, gravity, wind, targetArea: extended; Func: function: Boolean; Bank: Boolean = False): Boolean;
    var
      veloX,veloY,windX,windY,veloMag,dist,randomDist,lastDist,step: extended;
      lastX,lastY,MSP,W,maxStep: integer;
      sqrt2,sqrt3,sqrt5: extended;
    begin
      if (Func()) then Exit(True);
      Result := False;
      MSP    := MouseSpeed;
      sqrt2  := sqrt(2);
      sqrt3  := sqrt(3);
      sqrt5  := sqrt(5);

      repeat
        dist:= hypot(xs - xe, ys - ye);
        wind:= minE(wind, dist);
        maxStep := (RandomRange(2, 4));

        if dist >= targetArea then
        begin
          windX:= windX / sqrt3 + (random(round(wind) * 2 + 1) - wind) / sqrt5;
          windY:= windY / sqrt3 + (random(round(wind) * 2 + 1) - wind) / sqrt5;
        end else
        begin
          windX:= windX / sqrt2;
          windY:= windY / sqrt2;
        end;

        veloX:= veloX + windX;
        veloY:= veloY + windY;
        veloX:= veloX + gravity * (xe - xs) / dist;
        veloY:= veloY + gravity * (ye - ys) / dist;

        if hypot(veloX, veloY) > maxStep then
        begin
          randomDist:= maxStep / 2.0 + random(round(maxStep) div 2);
          veloMag:= sqrt(veloX * veloX + veloY * veloY);
          veloX:= (veloX / veloMag) * randomDist;
          veloY:= (veloY / veloMag) * randomDist;
        end;

        lastX:= Round(xs);
        lastY:= Round(ys);
        xs:= xs + veloX;
        ys:= ys + veloY;

        if (lastX <> Round(xs)) or (lastY <> Round(ys)) then
          MoveMouse(Round(xs), Round(ys));

        if (Func()) then
        begin
          MouseSpeed := MSP;
          Exit(True);
        end;

        if Bank then
          if (not itemsInBank()) then
          begin
            MouseSpeed := MSP;
            Exit(false);
          end;

        if RBool then
          W := (MSP + (Random(Round(MSP/4))))
        else
          W := (MSP - (RandomRange(Round(MSP/2), MSP-1)));

        if (W < 1) then
          W := 1;

        wait(W);

        step:= hypot(xs - lastX, ys - lastY);
        lastdist:= dist;
      until(hypot(xs - xe, ys - ye) < 1)

      if (Round(xe) <> Round(xs)) or (Round(ye) <> Round(ys)) then
        moveMouse(Round(xe), Round(ye));

      MouseSpeed := MSP;
    end;

    {*******************************************************************************
    procedure brakeMMouse(Pnt: TPoint; ranX, ranY: Integer; double: Boolean);
    By: Flight
    Description: Makes use of BrakeWindMouse; mouse speed decreases at 15% to
                 destination point.  If Double is set to true then speed starts
                 slow and increases through the first 15% of the path.
    *******************************************************************************}

    Procedure brakeMMouse(Pnt: TPoint; ranX, ranY: Integer; double: Boolean);
    var
      randSpeed : extended;
      X,Y,MS    : integer;
    begin
      MS        := MouseSpeed;
      randSpeed := (random(MouseSpeed) / 2.0 + MouseSpeed) / 10.0;
      getMousePos(X, Y);
      brakeWindMouse(X, Y, RandomRange(Pnt.X-ranX, Pnt.X+ranX), RandomRange(Pnt.Y-ranY,Pnt.Y+ranY),
        8, 3, 10.0*randSpeed, double);
      MouseSpeed := MS;
    end;

    {*******************************************************************************
    procedure accurateMMouse(Pnt: TPoint; ranX, ranY: Integer);
    By: Flight
    Description: Same as brakeMMouse but uses a much straighter path; required
                 for choosing tabbed options.
    *******************************************************************************}

    Procedure accurateMMouse(Pnt: TPoint; ranX, ranY: Integer);
    var
      randSpeed : extended;
      X,Y,MS    : integer;
    begin
      MS := MouseSpeed;
      randSpeed := (random(MouseSpeed) / 2.0 + MouseSpeed) / 10.0;
      getMousePos(X, Y);
      brakeWindMouse(X, Y, RandomRange(Pnt.X-ranX, Pnt.X+ranX), RandomRange(Pnt.Y-ranY,Pnt.Y+ranY), 14, 3, 10.0*randSpeed, False);
      MouseSpeed := MS;
    end;

    Function humanMMouseTxt(Pnt: TPoint; ranX, ranY: Integer; TxtArr: TStringArray): Boolean;
    var
      randSpeed: extended;
      X,Y,MS: integer;
    begin
      Result    := False;
      MS        := MouseSpeed;
      randSpeed := (random(MouseSpeed) / 2.0 + MouseSpeed) / 10.0;
      getMousePos(X, Y);
      Result := humanWindMouse(X, Y, RandomRange(Pnt.X-ranX, Pnt.X+ranX), RandomRange(Pnt.Y-ranY,Pnt.Y+ranY), 7, 5, 10.0 * randSpeed, TxtArr);
    end;

    {*******************************************************************************
    function humanMMouse(Pnt: TPoint; ranX, ranY: Integer): Boolean;
    By: Flight
    Description:...
    *******************************************************************************}

    Procedure humanMMouse(Pnt: TPoint; ranX, ranY: Integer);
    var
      randSpeed: extended;
      X,Y,MS: integer;
    begin
      MS        := MouseSpeed;
      randSpeed := (random(MouseSpeed) / 2.0 + MouseSpeed) / 10.0;
      getMousePos(X, Y);
      humanWindMouse(X, Y, RandomRange(Pnt.X-ranX, Pnt.X+ranX), RandomRange(Pnt.Y-ranY,Pnt.Y+ranY), 7, 5, 10.0 * randSpeed, []);
      MouseSpeed := MS;
    end;

    {*******************************************************************************
    procedure shiftWindMouse(xs, ys, xe, ye, gravity, wind, minWait, maxWait, maxStep,
      targetArea: extended);
    By: Flight
    Description: Mouse movement that shifts speed after every mouse 'step'
    *******************************************************************************}

    procedure shiftWindMouse(xs, ys, xe, ye, gravity, wind, minWait, maxWait, maxStep, targetArea: extended);
    var
      veloX,veloY,windX,windY,veloMag,dist,randomDist,lastDist,step: extended;
      lastX,lastY,MS: integer;
      sqrt2,sqrt3,sqrt5: extended;
    begin
      MS := MouseSpeed;
      sqrt2:= sqrt(2);
      sqrt3:= sqrt(3);
      sqrt5:= sqrt(5);
      while hypot(xs - xe, ys - ye) > 1 do
      begin
        dist:= hypot(xs - xe, ys - ye);
        wind:= minE(wind, dist);
        if dist >= targetArea then
        begin
          windX:= windX / sqrt3 + (random(round(wind) * 2 + 1) - wind) / sqrt5;
          windY:= windY / sqrt3 + (random(round(wind) * 2 + 1) - wind) / sqrt5;
        end else
        begin
          windX:= windX / sqrt2;
          windY:= windY / sqrt2;
          if (maxStep < 3) then
            maxStep := (random(3) + 3.0)
          else
            maxStep := (maxStep/sqrt5);
        end;
        veloX:= veloX + windX;
        veloY:= veloY + windY;
        veloX:= veloX + gravity * (xe - xs) / dist;
        veloY:= veloY + gravity * (ye - ys) / dist;
        if hypot(veloX, veloY) > maxStep then
        begin
          randomDist:= maxStep / 2.0 + random(round(maxStep) div 2);
          veloMag:= sqrt(veloX * veloX + veloY * veloY);
          veloX:= (veloX / veloMag) * randomDist;
          veloY:= (veloY / veloMag) * randomDist;
        end;
        lastX:= Round(xs);
        lastY:= Round(ys);
        xs:= xs + veloX;
        ys:= ys + veloY;

        case Random(2) of
          1: MouseSpeed := (MS+(RandomRange(2,5)));
          2: MouseSpeed := (MS-(RandomRange(2,5)));
        end;
        if (MouseSpeed < 4) then
          MouseSpeed := 4;

        if (lastX <> Round(xs)) or (lastY <> Round(ys)) then
          MoveMouse(Round(xs), Round(ys));

        step:= hypot(xs - lastX, ys - lastY);
        wait(round((maxWait - minWait) * (step / maxStep) + minWait));
        lastdist:= dist;
        MouseSpeed := MS;
      end;

      case Random(2) of
        1: MouseSpeed := (MS+(RandomRange(2,5)));
        2: MouseSpeed := (MS-(RandomRange(2,5)));
      end;
      if (MouseSpeed < 4) then
        MouseSpeed := 4;

      if (Round(xe) <> Round(xs)) or (Round(ye) <> Round(ys)) then
        MoveMouse(Round(xe), Round(ye));

      MouseSpeed := MS;
    end;

    {*******************************************************************************
    procedure missMouse(Pnt: TPoint; ranX, ranY: Integer);
    By: Flight
    Description: Makes use of ShiftWindMouse; it also initially misses the target
                 point (miss area determined by dist & speed) then corrects itself.
    *******************************************************************************}

    Procedure missMouse(Pnt: TPoint; ranX, ranY: Integer);
    var
      randSpeed: extended;
      X,Y,X2,Y2,A,Dist,MP: integer;
    begin
      A := MouseSpeed;
      getMousePos(X, Y);
      Dist := Distance(X, Y, Pnt.X, Pnt.Y);
      MP := Round(Dist/150);
      if MP < 0 then
        MP := 1;

      randSpeed := (random(MouseSpeed) / 2.0 + MouseSpeed) / 10.0;
      X2 := RandomRange(Pnt.X-(A*MP), Pnt.X+(A*MP));
      Y2 := RandomRange(Pnt.Y-(A*MP), Pnt.Y+(A*MP));
      shiftWindMouse(X, Y, X2, Y2, 11, 8, 10.0 / randSpeed, 12.0 / randSpeed, 10.0 * randSpeed, 10.0 * randSpeed);
      getMousePos(X, Y);
      MouseSpeed := round(A*0.7);
      if MouseSpeed < 7 then
        MouseSpeed := 7;
      brakeMMouse(Pnt, ranX, ranY, True);
      MouseSpeed := A;
    end;

    {*******************************************************************************
    procedure fastClick(button: Integer);
    By: Flight
    Description: Quickly click or right-click the mouse.
    *******************************************************************************}

    procedure fastClick(button: Integer);
    var
      x, y: integer;
    begin
      if ((button = MOUSE_MOVE) or (button = -1)) then Exit;
      getMousePos(x, y);
      holdMouse(x, y, button);

      wait(60+random(100));

      getMousePos(x, y);
      releaseMouse(x, y, button);
    end;

    {*******************************************************************************
    procedure fastClickAmount(Amount:Integer);
    By: Flight
    Description: Quickly left-quick the mouse X amount of times.  Used in banking
                 methods and beyond.
    *******************************************************************************}

    procedure fastClickAmount(Amount:Integer);
    var
      i : Integer;
    begin
      for i:=1 to Amount do
      begin
        fastClick(MOUSE_LEFT);
        wait(randomRange(10,130));
      end;
    end;

    (*
    DidClick
    ~~~~~~~~

    .. code-block:: pascal

        function DidClick(Red: Boolean; Time: integer): boolean;

    Checks for the X after a click, Times Out after Time.
    DidClick Time must be at LEAST 200 now.

    .. note::

        by Rasta Magician
        Modded by Justin on 1/03/2013

    Example:

    .. code-block:: pascal

    *)

    function didClick(Red: Boolean; Time: integer): boolean;
    var
      T : Timer;
      B : TBox;
      colR,colG : TColEx;
    begin
      B := pointToBox(getMousePnt(), 15);
      checkAreaBounds(B);
      colR.create(255, 15);
      colG.create(65535, 15);
      T.start();
      while (T.timeElapsed < Time) do
      begin
        if Red then
        begin
          if (colG.count(B) > 8) then
            Exit;
          if (colR.count(B) > 10) then
            Exit(true);
        end else
        begin
          if (colR.count(B) > 5) then
            Exit;
          if (colG.count(B) > 35) then
            Exit(true);
        end;
      end;
    end;

    (*
    DidRedClick
    ~~~~~~~~~~~

    .. code-block:: pascal

        function didRedClick(): Boolean;

    Checks for the Red X after a Click, Times out after 500 ms

    .. note::

        by Rasta Magician

    Example:

    .. code-block:: pascal

    *)

    function didRedClick(): Boolean;
    begin
      Result := didClick(true, 1000);
    end;

    (*
    DidYellowClick
    ~~~~~~~~~~~~~~

    .. code-block:: pascal


        function didYellowClick(): Boolean;

    Checks for the Yellow X after a Click, Times out after 500 ms

    .. note::

        by Rasta Magician

    Example:

    .. code-block:: pascal

    *)

    function didYellowClick(): Boolean;
    begin
      Result := didClick(false, 1000);
    end;

    procedure mouse(Pnt: TPoint; rX, rY, clickType: Integer);
    begin
      humanMMouse(Pnt, rX, rY);
      wait(randomRange(50,150));
      fastClick(clickType);
    end;

    {*******************************************************************************
    procedure mouseBox(x1, y1, x2, y2, Dist, ClickType: Integer);
    By: Raymond (modded by Flight)
    Description: Does mouse stuff (ClickType), and uses a point that is within Dist from
                 the closest point between mouse and the box.
    *******************************************************************************}

    Procedure mouseBox(x1, y1, x2, y2: Integer; Dist, ClickType: Integer);
    var
      Pnt : TPoint;
    begin
      getMousePos(Pnt.x,Pnt.y);
      Pnt := randomPointBoxEx(Pnt,toBox(x1,y1,x2,y2),Dist);
      missMouse(Pnt, 0, 0);
      wait(randomRange(100,150));
      fastClick(ClickType);
    end;

    Procedure mouseBox(B: TBox; ClickType: Integer); overload;
    var
      Pnt : TPoint;
    begin
      getMousePos(Pnt.x,Pnt.y);
      gaussBox(Pnt.x, Pnt.y, B.X1, B.Y1, B.X2, B.Y2);
      brakeMMouse(Pnt, 0, 0, True);
      wait(randomRange(100,150));
      fastClick(ClickType);
    end;

    Procedure mouseBox2(B: TBox; ClickType: Integer); overload;
    var
      Pnt : TPoint;
    begin
      getMousePos(Pnt.x,Pnt.y);
      gaussBox(Pnt.x, Pnt.y, B.X1, B.Y1, B.X2, B.Y2);
      missMouse(Pnt, 0, 0);
      wait(randomRange(35,85));
      fastClick(ClickType);
    end;

    (*
    GaussMouseBox
    ~~~~~~~~

    .. code-block:: pascal

        procedure gaussMouseBox(x1, y1, x2, y2: Integer; ClickType: Integer);

    Moves mouse into a random position in the box. Clicks if told to.

    .. note::

        by Nava2

    Example:

    .. code-block:: pascal

    *)

    procedure gaussMouseBox(x1, y1, x2, y2: Integer; ClickType: Integer);
    var
      fx, fy: Integer;
    begin
      gaussBox(fx, fy, x1, y1, x2, y2);

      if InRange(ClickType, mouse_Right, mouse_move) then
        mouse(point(fx,fy), 0, 0, clickType)
      else
      begin
        writeln('[gaussMouseBox] ClickType invalid');
        exit;
      end;
    end;

    function mouseInBox(Box: TBox): Boolean;
    var
      X,Y : Integer;
    begin
      getMousePos(X, Y);
      Result := pointInBox(Point(X, Y), Box);
    end;

    procedure dragMouseBox(BoxA, BoxB: TBox);
    var
      x,y : Integer;
    begin
      if not mouseInBox(BoxA) then
      begin
        mouseBox(BoxA, MOUSE_MOVE);
        wait(150 + random(20));
      end;

      getMousePos(x, y);
      holdMouse(x, y, MOUSE_LEFT);
      wait(250 + random(320));
      mouseBox(BoxB, MOUSE_MOVE);
      wait(250 + random(120));
      getMousePos(x, y);
      releaseMouse(x, y, MOUSE_LEFT);
    end;

    procedure dragMouseToPoint(Point: TPoint);
    var
      x,y : Integer;
    begin
      getMousePos(x, y);
      holdMouse(x, y, MOUSE_LEFT);
      wait(randomRange(35,85));
      brakeMMouse(Point, 0, 0, False);
      wait(randomRange(35,85));
      getMousePos(x, y);
      releaseMouse(x, y, MOUSE_LEFT);
    end;

    procedure mouseCircle(cx, cy, radius, clickType: Integer);
    var
      rPnt : TPoint;
      TPA  : TPointArray;
    begin
      if not InRange(clickType, 0, 3) then
        Exit;

      TPA := TPAFromEllipse(cx, cy, radius, radius);
      if (length(TPA) < 1) then
        Exit;

      rPnt := TPA[randomRange(0,high(TPA))];

      case RandomRange(1,3) of
        1: brakeMMouse(rPnt, 0, 0, True);
        2: humanMMouse(rPnt, 0, 0);
        3: missMouse(rPnt, 0,0);
      end;
      fastClick(clickType);
    end;

    Procedure typeByte(B: Byte);
    begin
      if (B = 13) then
        B:= 10;
      keyDown(B);
      Wait(10 + Random(50));
      keyUp(B);
    end;

    Procedure typeSend(Text: String; Send: Boolean = True);
    var
      I: Integer;
    begin
      for I := 1 to Length(Text) do
      begin
        sendKeys(Text[i], 40+Random(40), 15+Random(30));
        Wait(20 + Random(40));
      end;

      if Send then
      begin
        {$IFDEF SMART}
          typeByte(VK_ENTER);
        {$ELSE}
          pressKey(VK_ENTER);
        {$ENDIF}
      end;
    end;

  3. #3
    Join Date
    Nov 2018
    Posts
    4
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Thanks for the help, but this one was worse than the SRL one, anyways it had me meddle with the wind mouse procedure and it turns out that changing targetArea field to 1000 prevents it from ever getting loopy.

  4. #4
    Join Date
    Jan 2019
    Posts
    23
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    Loopy? You mean you like it going in straight lines all the time etc?

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
  •