Results 1 to 14 of 14

Thread: Recommend Mouse Procedure?

  1. #1
    Join Date
    Jan 2007
    Location
    Uk
    Posts
    38
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Recommend Mouse Procedure?

    JUst a small question, Which Mouse Procedure do you think is the best to use taking into account detectability?

    ~Endr1x~ (h)

  2. #2
    Join Date
    Sep 2006
    Posts
    5,219
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    Mouse for moving and clicking
    MMouse for just moving

    Look in SRL/core/MouseFlag.scar

  3. #3
    Join Date
    Jun 2006
    Location
    N Wales
    Posts
    558
    Mentioned
    2 Post(s)
    Quoted
    56 Post(s)

    Default

    i say a mixture this might make it longer to make when making the script but its a lot more undetectable since it means your more like a human doing things differently instead of the same all the time.

  4. #4
    Join Date
    Sep 2006
    Posts
    5,219
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    Mouse and MMouse already do it differently. For a test, do

    MMouse-startpoint
    HoldMouse
    MMouse-end point
    ReleaseMouse

    repeat that a few times in paint with the pencil. It will take a different path each time.

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

    Default

    Well, sorry to all you SRL peeps around here, but I'd have to side with deadmouse (400 line mouse procedure!)

    It can be found here-http://www.moparisthebest.com/smf/index.php/topic,7455.0.html

    deadmouse(500,500,15,10,4); made this test pic:


    Custom deadmouse.scar with custom variables to work with SRL is at the bottom.

    Code:
    program MouseTest;
    var
    i:integer;
    {.include SRL\SRL.scar}
    {.include deadmouse.scar}
    begin
    SetupSRL;
    ActivateClient;
    wait(500);
    
    for i:= 1 to 10 do
    begin
    MMouse(5,5,0,0);
    HoldMouse(5,5,true);
    MMouse(250,250,0,0);
    ReleaseMouse(250,250,true);
    end;
    
    wait(1000);
    for i:= 1 to 10 do
    begin
    movemouse(275,275);
    HoldMouse(275,275,true);
    deadmouse(500,500,15,10,4);
    ReleaseMouse(500,500,true);
    end;
    end.
    Code:
    (* Realistic mouse script by *DEAD*
    Ok, this is my first mouse script worthy of releasing, and it looking really good.
    Its a different type of mouse script design from all my others and most others
    ive seen. It works by "homing" in on a target, which means you can "bump" the mouse
    randandomly change its direction, and it would correct itself, much like a real person would.
    
    There are lots of required varables, so ill go through them.
    
    tomouse(targx,targy,maxspeed,minspeed,square,accuracy,turnspeed,acceleration,deceleration:integer; finishingtouch:boolean);
    targx and targy are the x,y coords of the point the mouse is to move to.
    maxspeed is the speed at which the mouse accelerates to.
    minspeed is the minimum speed of the mouse, with out it the mouse would stop (i intend to find a work around which will fix this).
    Think of square as the randomness of each small mouse movement. Each time the script is given a coordanate to move to, the mouse moves to a coordanate close to that point which is inside a square.
    accuracy is how close the cursor has to be to the target before it stops
    turnspeed is how fast the mouse can change direction. This is actually a percentage (0 - 100) of the difference between the target angle and the current angle (i recomend 20 - 25) (known glitch, sometimes it will just keep circling around the target, im working on it)
    acceleration is the rate at which the mouse accelerates(%)
    deceleration is the rate at which the mouse decelerates(%)
    
    finishingtouch will move the mouse to the target after the main move mouse script stops. With out this, the mouse could stop within "accuracy" pixels from the target
    there is one more varable, curangle. This is a global, but when i release the actual script it will be fixed. Curangle is the angle at which the mouse is traveling at any given time. If you change its start value, the mouse will start moving in a different direction. Remember, since on a computer screen the y axis is at the top of the screen and counts up as it goes down, the circle will be inverted. so 90 is downward, 270 is upward, 0 is right, and 180 is left.
    
    
    The best thing about this script is that its easy to add on to.
    Ive included a "bump" procedure which randomly change the mouses direction,
    and the the mouse will correct itself all by itself. cool eh. This means
    you can do anything from making a quick jolt, to emulating the mouse falling
    off the desk.
    
    (UPDATE)
    now that the script is complete, i have made it alot simpler.
    the procedure is now
    deadmouse(targx,targy,speed,turnspeed,acceleration:integer; finishingtouch:boolean);
    finishing touch isnt really neccesary any more, however i guess it would help.
    
    Enjoy
    *)
    
    var
       finishingtouch,overshoot:boolean;
    
    function loge(i:extended) : extended;
    var
       count,exp:integer;
       xval:extended;
    begin
         exp:= 1;
         xval:= (i - 1) / (i + 1);
         for count:= 1 to 5 do
         begin
              result:= result + pow(xval,exp)/exp;
              exp:= exp + 2;
         end;
         result:= result * 2;
    end;
    
    function logb(base,i:extended) : extended;
    begin
         result:= loge(i)/loge(base);
    end;
    
    function abscustom(i : extended) : extended;
    begin
         i:= sqrt(i*i);
         result := i;
    end;
       
    function fact(i : integer) : integer;
    var
       holdi,res : integer;
    begin
         holdi := i;
         res := 1;
         for i := 1 to holdi do
         begin
              res := i * res
         end;
         result := res;
    end;
       
    function arctancustom(e : extended) : extended;
    var
       count : integer;
       res : extended;
       inv : boolean;
    begin
         if(abscustom(e) > 1)then
         begin
              e := pow(e,-1);
              inv := true;
         end else
         begin
              inv := false;
         end;
         for count := 0 to 6 do
         begin
              res := res + ( ( pow(2,2 * count) * pow(fact(count),2) ) / fact(2 * count + 1) ) *  ( ( pow(e,2*count+1) ) / ( pow(1 + pow(e,2),count + 1) ) );
         end;
         if(inv)then
         begin
              res := 1.5707963267 - res;
         end;
         result := res;
    end;
    
    procedure findintercept(var x,y:integer; targx,targy,radius:integer; i,j:extended);
    begin
         x:= round(x + i * radius);
         y:= round(y + j * radius);
    end;
    
    procedure adjangle(x,y,targx,targy,rate:integer; var i,j:extended; var curangle:integer);
    var
       targangle,degreescustom,angledifft,anglediffc:integer;
       radianscustom:extended;
    begin
         if(targx - x = 0) or (targy - y = 0)then
         begin
              if(targx - x = 0)then
              begin
                   if(targy - y > 0)then
                   begin
                        targangle:= 270;
                   end else
                   begin
                        targangle:= 90;
                   end;
              end;
              if(targy - y = 0)then
              begin
                   if(targx - x > 0)then
                   begin
                        targangle:= 180;
                   end else
                   begin
                        targangle:= 0;
                   end;
              end;
         end else
         begin
              degreescustom:= round(arctancustom(abscustom((x - targx)/(y - targy))) * 180 / pi);
              if(targx - x > 0)then
              begin
                   if(targy - y > 0)then
                   begin
                        targangle:= 90 - degreescustom;
                   end else
                   begin
                        targangle:= 270 + degreescustom;
                   end;
              end else
              begin
                   if(targy - y > 0)then
                   begin
                        targangle:= 90 + degreescustom;
                   end else
                   begin
                        targangle:= 270 - degreescustom;
                   end;
              end;
         end;
         anglediffc:= curangle - targangle;
         angledifft:= targangle - curangle;
         if(anglediffc < 0)then
         begin
              anglediffc:= anglediffc + 360;
         end;
         if(angledifft < 0)then
         begin
              angledifft:= angledifft + 360;
         end;
         if(curangle <> targangle)then
         begin
              if(angledifft > anglediffc)then
              begin
                   curangle:= curangle - round(rate / 100 * anglediffc);
              end else
              begin
                   curangle:= curangle + round(rate / 100 * angledifft);
              end;
         end;
         if(curangle < 0)then
         begin
              curangle:= curangle + 360;
         end;
         if(curangle > 360)then
         begin
              curangle:= curangle - 360;
         end;
         radianscustom:= curangle * pi / 180;
         i:= cos(radianscustom);
         j:= sin(radianscustom);
    end;
    
    procedure bump(var curangle:integer);
    begin
         if(random(10) < 1)then
         begin
              curangle:= round(curangle - 0.5 * 40 + random(40));
         end;
    end;
    
    procedure accelerate(x,y,targx,targy,speed,acceleration:integer; var curspeed:extended; var decelerate:boolean);
    var
       dist,dedist,deceleration,time:extended;
    begin
         deceleration:= -acceleration / 100 + 1;
         if(curspeed <> 0)then
         begin
              dist:= sqrt(pow(targx - x, 2) + pow(targy - y, 2));
              time:= logb(deceleration,5/curspeed);
              dedist:= curspeed * (1 - pow(deceleration,time))/(1 - deceleration);
         end else
         begin
              dedist:= dist - 1;
         end;
         if(dist < dedist)then
         begin
              decelerate:= true;
         end;
         if(decelerate)then
         begin
              if(curspeed > 5)then
              begin
                   curspeed:= curspeed * deceleration;
              end;
         end else
         begin
              curspeed:= curspeed + acceleration / 100 * (speed - curspeed);
         end;
    end;
    
    procedure changeturnspeed(x,y,targx,targy,turnspeed,totaldist:integer; var curturnspeed :integer);
    var
       dist:extended;
       hold:integer;
       exp:integer;
    begin
         if(totaldist > 100)then
         begin
              exp:= 2;
         end else
         begin
              exp:= totaldist/100;
         end;
         dist:= sqrt(pow(targx - x, 2) + pow(targy - y, 2));
         hold:= round(pow(100 - turnspeed,pow((totaldist - dist)/totaldist,exp)) + turnspeed);
         if(hold > curturnspeed)then
         begin
              curturnspeed:= hold;
         end;
    end;
    
    procedure randomcurangle(x,y,targx,targy:integer; var curangle:integer);
    var
       targangle,degreescustom:integer;
    begin
         if(targx - x = 0) or (targy - y = 0)then
         begin
              if(targx - x = 0)then
              begin
                   if(targy - y > 0)then
                   begin
                        targangle:= 270;
                   end else
                   begin
                        targangle:= 90;
                   end;
              end;
              if(targy - y = 0)then
              begin
                   if(targx - x > 0)then
                   begin
                        targangle:= 180;
                   end else
                   begin
                        targangle:= 0;
                   end;
              end;
         end else
         begin
              degreescustom:= round(arctancustom(abscustom((x - targx)/(y - targy))) * 180 / pi);
              if(targx - x > 0)then
              begin
                   if(targy - y > 0)then
                   begin
                        targangle:= 90 - degreescustom;
                   end else
                   begin
                        targangle:= 270 + degreescustom;
                   end;
              end else
              begin
                   if(targy - y > 0)then
                   begin
                        targangle:= 90 + degreescustom;
                   end else
                   begin
                        targangle:= 270 - degreescustom;
                   end;
              end;
         end;
         curangle:= targangle - 45 + random(90);
         if(curangle > 0)then
         begin
              curangle:= curangle + 360;
         end;
    end;
    
    procedure gravity(var x,y:integer; gravpointx,gravpointy,grav,pull:integer);
    var
       gravx,gravy:integer;
       slope:extended;
    begin
         if(x - gravpointx = 0)or(y - gravpointy = 0)then
         begin
              if(x - gravpointx = 0)then
              begin
                   gravy:= grav;
              end else
              begin
                   gravx:= grav;
              end;
         end else
         begin
              repeat
              if(not(y-gravy>0))then
              gravy:=gravy+1;
              until(y-gravy>0)
              slope:= (x - gravx)/(y - gravy);
              gravx:= round(grav/(1 + slope));
              gravy:= round((grav/(1 + slope)) * slope);
         end;
         if(gravpointx > x)then
         begin
              x:= x - gravx;
         end else
         begin
              x:= x + gravx;
         end;
         if(gravpointy > y)then
         begin
              y:= y - gravy;
         end else
         begin
              y:= y + gravy;
         end;
    end;
    
    procedure deadtomouse(targx,targy,maxspeed,turnspeed,acceleration:integer);
    var
       curspeed:extended;
       square,totaldistance,curturnspeed,grav,gravpointx,gravpointy,pull:integer;
       i,j:extended;
       x,y:integer;
       decelerate:boolean;
       curangle:integer;
    begin
         getmousepos(x,y);
         curspeed:= 0;
         totaldistance:=  round(sqrt(pow(targx - x, 2) + pow(targy - y, 2)));
         randomcurangle(x,y,targx,targy,curangle);
         pull:= random(2);
         gravpointx:= random(round(abscustom(targx-x)));
         gravpointy:= random(round(abscustom(targy-y)));
         if(targx > x)then
         begin
              gravpointx:= targx - gravpointx;
         end else
         begin
              gravpointx:= targx + gravpointx;
         end;
         if(targy > y)then
         begin
              gravpointy:= targy - gravpointy;
         end else
         begin
              gravpointy:= targy + gravpointy;
         end;
         repeat
               accelerate(x,y,targx,targy,maxspeed,acceleration,curspeed,decelerate);
               changeturnspeed(x,y,targx,targy,turnspeed,totaldistance,curturnspeed);
               adjangle(x,y,targx,targy,curturnspeed,i,j,curangle);
               findintercept(x,y,targx,targy,round(curspeed),i,j);
               if(decelerate <> true)then
               begin
                    gravity(x,y,gravpointx,gravpointy,grav,pull);
               end;
               grav:= round(curspeed * 0.25);
               bump(curangle);
               square:= round(curspeed / 4);
               x:= round(x + random(square) - 0.5 * square);
               y:= round(y + random(square) - 0.5 * square);
               movemouse(x,y);
               wait(10 + random(10));
         until(y < targy + 10)and(y > targy - 10)and(x < targx + 10)and(x > targx - 10);
         if(finishingtouch)then
         begin
              movemouse(targx,targy)
         end;
    end;
    
    procedure deadmouse(targx,targy,maxspeed,turnspeed,acceleration:integer);
    var
       metatargx,metatargy,overshootdist,totaldist,x,y:integer;
    begin
         if(overshoot)then
         begin
              if(random(4) < 3)then
              begin
                   getmousepos(x,y);
                   totaldist:= round(sqrt(pow(targx - x, 2) + pow(targy - y, 2)));
                   writeln(inttostr(totaldist));
                   overshootdist:= round(totaldist * 0.1 + random(round(totaldist*0.1)));
                   if(totaldist > round(0.5 * maxspeed)) then
                   begin
                        overshootdist:= overshootdist + random(maxspeed * 2);
                   end;
                   if(random(2) = 1)then
                   begin
                   metatargx:= targx + overshootdist;
                   end else
                   begin
                        metatargx:= targx - overshootdist;
                   end;
                   overshootdist:= random(2 * maxspeed);
                   overshootdist:= overshootdist + maxspeed;
                   if(random(2) = 1)then
                   begin
                        metatargy:= targy + overshootdist;
                   end else
                   begin
                        metatargy:= targy - overshootdist
                   end;
                   deadtomouse(metatargx,metatargy,maxspeed,turnspeed,acceleration);
                   wait(100 + random(200));
              end;
         end;
         deadtomouse(targx,targy,maxspeed,turnspeed,acceleration);
    end;
    Creds to *DEAD* for this awesome mouse procedure
    Interested in C# and Electrical Engineering? This might interest you.

  6. #6
    Join Date
    Sep 2006
    Posts
    916
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    PHP Code:
    program New;
    {.include 
    SRL/SRL.scar}

    procedure test;
    begin
    MMouse
    (12817000);
    GetMousePos(xy);
    HoldMouse(xytrue);
    MMouse(107967000);
    GetMousePos(xy);
    ReleaseMouse(xyTrue);
    end;


    begin
    SetupSRL
    ;
    ActivateClient;
    repeat
    test
    ;
    until(false)
    end
    Run that in paint with the canvas as big as you can get it. Watch it a few times :P.

  7. #7
    Join Date
    Jun 2006
    Posts
    1,492
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Atcually, i prefer deadmouse better. But since all SRL procs are already callibrated for Benmouse's spline, i use his :P

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

    Default

    also-some of deadmouse's variables conflict with srl's, so i had to change some stuff in it; thats why I posted my own version. I also fixed a div by 0 error that i got pretty often.
    Interested in C# and Electrical Engineering? This might interest you.

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

    Default

    I go with MMouse.
    It takes a more direct rout to the point and its smoother
    Deadmouse seems way too random and shakey like an old man having sex is playing runescape.

    But thats just my opinion

    Deadmouse stuff looks cool though.

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

    Default

    haha old man

    I think you could make Deadmouse less shakey...just set the turning acceleration lower
    Interested in C# and Electrical Engineering? This might interest you.

  11. #11
    Join Date
    Sep 2006
    Posts
    916
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by yohojo8 View Post
    I go with MMouse.
    It takes a more direct rout to the point and its smoother
    Deadmouse seems way too random and shakey like an old man having sex is playing runescape.

    But thats just my opinion

    Deadmouse stuff looks cool though.
    Owned rofl!

  12. #12
    Join Date
    Jan 2007
    Location
    Kansas
    Posts
    3,760
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    In the pic I think that MMouse looks more like what he did himself than deadmouse does


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

    Default

    hmmm....I have to agree...I guess I'll have to try messin with the settings some...

    EDIT: Tweaked settings, and it came out a whole lot better! Uploaded new image, and added the fixed deadmouse code to the test script
    Interested in C# and Electrical Engineering? This might interest you.

  14. #14
    Join Date
    Mar 2006
    Posts
    13,241
    Mentioned
    228 Post(s)
    Quoted
    267 Post(s)

    Default

    Quote Originally Posted by Smartzkid View Post
    EDIT: Tweaked settings, and it came out a whole lot better! Uploaded new image, and added the fixed deadmouse code to the test script
    mmouse still looks closer to urs then deadmouse...dead mouse looks like its trying to recreate a guy high on pot during an earthquake trying to draw lines
    STOP PM'ING ME

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Game freezes on procedure Mouse
    By Bad Processor in forum OSR Help
    Replies: 7
    Last Post: 10-29-2008, 08:59 PM
  2. procedure Mouse not working?
    By alartt in forum OSR Help
    Replies: 4
    Last Post: 09-30-2007, 01:07 PM
  3. Random mouse procedure
    By HairyDuncan2 in forum OSR Help
    Replies: 4
    Last Post: 08-18-2007, 04:17 AM

Posting Permissions

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