Results 1 to 6 of 6

Thread: Mouse vs Efficiency

  1. #1
    Join Date
    Oct 2011
    Location
    Vegas :D
    Posts
    80
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Mouse vs Efficiency

    Alright Guys, so recently I was working on several mouse methods because I need to send a mouse click as fast as possible, move to another color and click it as fast as possible.

    So The first method I'm going to be talking about is MMouse and Mouse ( Now these are two different methods but the difference between the two is about 3 milliseconds. So If we look at MMouse's code.

    Simba Code:
    procedure MMouse(x, y, rx, ry: integer);
    var
      cx, cy: integer;
      randSpeed: Extended;
      {$IFDEF UseLaptopMouse}
        seg, e, f, g, nx, ny, hypo: Integer;
        a, b, c: Extended;
        Miss: Boolean;
      {$ENDIF}
    begin
      GetMousePos(cx, cy);
      {$IFDEF UseLaptopMouse}
        miss := (Random(LMouse_MissChance) = 0);
        e:= 0;
        a:= x - cx;
        b:= y - cy;
        c:= Pow(a,2) + Pow(b,2)
        hypo:= Round(Sqrt(c));
        case hypo of
          0: Exit;
          1..225: seg:=1;
          226..600: seg:= Random(2) + 1;
          601..1800: seg:= random(3) + 2;
          else seg := 5;
        end;
        f := Round( a / seg);
        g := Round( b / seg);
        repeat
          Wait(30 + random(50));
        {Begin: Modified from MMouse by Benland100}
          randSpeed := (random(MouseSpeed) / 2.0 + MouseSpeed) / 10.0;
          if randSpeed = 0.0 then
            randSpeed := 0.1;
          getMousePos(cx,cy);
          nx:= (cx + (f * e)) + random(rx);
          ny:= (cy + (g * e)) + random(ry);
        {End: Modified from MMouse by Benland100}
          if Miss then
          begin
            nx:= nx + RandomRange(rx, rx * 2);
            ny:= ny + RandomRange(ry, ry * 2);
          end;
          WindMouse(cx,cy,nx,ny,11.0,8.0,10.0/randSpeed,12.0/randSpeed,10.0*randSpeed,10.0*randSpeed);
          e:= e + 1;
        until(e = seg);
        GetMousePos(cx, cy);
        if not PointInBox(Point(cx, cy), IntToBox(x, y, x + rx, y + ry)) then
        begin
          Wait(30 + random(30));
          WindMouse(cx,cy,(x + random(rx)),(y + random(ry)),11.0,6.0,10.0/randSpeed,15.0/randSpeed,10.0*randSpeed,10.0*randSpeed);
        end;
      {$ELSE}
        randSpeed:= (random(MouseSpeed) / 2.0 + MouseSpeed) / 10.0;
        if randSpeed = 0.0 then
          randSpeed := 0.1;
        X := x + random(rx);
        Y := y + random(ry);
        WindMouse(cx,cy,x,y,9.0,3.0,10.0/randSpeed,15.0/randSpeed,10.0*randSpeed,10.0*randSpeed);
      {$ENDIF}
    end;

    Now if you analyze that code, you see that it first has to calculate a random range, and passes that into WindMouse which does some more calculating on pushing the mouse on a spline.
    So here is my result ( in milliseconds ).
    Code:
    421
    375
    452
    359
    405
    374
    406
    374
    422
    390
    405
    390
    390
    375
    421
    374
    405
    390
    359
    405
    390
    406
    390
    405
    390
    374
    437
    406
    375
    452
    390
    390
    As you can see at about 400 milliseconds a push at lets say 200 pushes can really slow down a program.
    Now lets look at a direct call to Mouse.
    A direct call to the MoveMouse method rather then the MMouse is a api call to Smart/The interpreter.
    Code:
    250
    281
    249
    250
    249
    250
    234
    250
    234
    250
    202
    266
    234
    234
    234
    280
    250
    265
    218
    266
    202
    203
    218
    265
    281
    250
    218
    218
    234
    202
    250
    218
    265
    266
    265
    265
    234
    218
    234
    281
    250
    249
    234
    281
    203
    250
    234
    249
    219
    249
    So you can do
    Simba Code:
    MoveMouse(X,Y);
    ClickMouse2(1);
    rather then
    Simba Code:
    MMouse(X,Y,RanX,RanY);

    My Two Cents.

  2. #2
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    -_____- A complain thread about a human mouse?

    If u want to get banned I suggest u start using MoveMouse(X, Y);
    I am Ggzz..
    Hackintosher

  3. #3
    Join Date
    Dec 2006
    Location
    Sydney, New South Wales, Australia
    Posts
    4,603
    Mentioned
    15 Post(s)
    Quoted
    42 Post(s)

    Default

    Mouse uses MMouse which uses WindMouse. You should never call MMouse which is followed by Mouse.

    Mouse = MMouse + Click
    You may contact me with any concerns you have.
    Are you a victim of harassment? Please notify me or any other staff member.

    | SRL Community Rules | SRL Live Help & Chat | Setting up Simba | F.A.Q's |

  4. #4
    Join Date
    Oct 2011
    Location
    Vegas :D
    Posts
    80
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by ggzz View Post
    -_____- A complain thread about a human mouse?

    If u want to get banned I suggest u start using MoveMouse(X, Y);
    If I don't wish to get banned, I could easily do

    Simba Code:
    MoveMouse(NewX + Random(10),NewY + Random(10));

    Which add's ~ 3-4 milliseconds.

  5. #5
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Quote Originally Posted by PhaseCode View Post
    If I don't wish to get banned, I could easily do

    Simba Code:
    MoveMouse(NewX + Random(10),NewY + Random(10));


    Which add's ~ 3-4 milliseconds.
    3-4 milliseconds is nothing.. Random(10) added 6 seconds total to it for me.. for "200" runs.
    I am Ggzz..
    Hackintosher

  6. #6
    Join Date
    Feb 2006
    Location
    Tracy/Davis, California
    Posts
    12,631
    Mentioned
    135 Post(s)
    Quoted
    418 Post(s)

    Default

    I don't understand what you are trying to get at here.
    When writing a script for RS you should use human-like mouse movment like Mouse/MMouse.
    Using MoveMouse/CickMouse on RS will get you banned in a snap, however if you are writing a Simba scripts for something else which doesn't check for macros, then go ahead and use MoveMouse/ClickMouse.

    I'm moving this out of tutorial section since it's not really of a tutorial and may confuse some new people.

    PFFFT 1 Year Grave Dig.
    Not my fault, someone reported this post.
    Last edited by YoHoJo; 04-06-2013 at 05:40 PM.

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
  •