Results 1 to 20 of 20

Thread: Mouse Macro

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

    Default Mouse Macro

    Mouse Macro, by Dan's The Man...

    This script is simple. It records your mouse movement and outputs it in a nice, SCAR-friendly scar script in the debug box

    Also, you might just want to delete the first 4 lines of the output'ed script (yes, it detects the run button clicks )

    Anyways, have fun

    scar Code:
    {$DEFINE Debug} //Add a // in front of this line (so it turns green) to not clear
            // the debug box (the box which is located at the bottom left of SCAR)
    //Mouse Macro by Mayazcherquoi (a.k.a Dan's The Man)
    //Records and outputs a SCAR-compatible script of your mouse movements and
      //actions.
    //Press F12 or CTRL+ALT+S to stop the script.
     
    program MouseMacro;

    var
      cx, cy, lx, ly, wt, mD, wtB, sT, Count: Integer;
      IMBDL, IMBDR: Boolean;

    procedure ScriptTerminate;
    begin
      Alert('Recording has stopped');
      Writeln('end.');
      GetSelf.WindowState := wsNormal;
    end;

    begin
      GetSelf.WindowState := wsMinimized;
      {$ifDef Debug}
        ClearDebug;
      {$endIf}
      sT := 3;
      Writeln('program New;');
      Writeln('  //Written by Mouse Macro, which was written by Mayazcherquoi (a.k.a Dan''s The Man)');
      Writeln('');
      Writeln('procedure ScriptTerminate;');
      Writeln('begin');
      Writeln('  GetSelf.WindowState := wsNormal;');
      Writeln('end;');
      Writeln('');
      Writeln('begin');
      Writeln('  GetSelf.WindowState := wsMinimized;');
      repeat
        Alert('Starting in: ' + IntToStr(sT));
        Dec(sT);
        Wait(995);
      Until(sT = 0);
      Alert('Recording has Started');
      wt := GetTimeRunning;
      repeat
        GetMousePos(cx, cy);
        wtB := GetTimeRunning - wt;
        if((cx <> lx) or (cy <> ly)) then
        begin
          if(not(wtB <= 0)) then
          begin
            Writeln('  Wait(' + IntToStr(wtB) + ');');
            wt := GetTimeRunning;
          end;
          Writeln('  MoveMouse(' + IntToStr(cx) + ', ' + IntToStr(cy) + ');');
          lx := cx;
          ly := cy;
        end;
        IMBDL := IsMouseButtonDown(True);
        IMBDR := IsMouseButtonDown(False);
        if((IMBDL) and (not(mD = 1))) then
        begin
          if(not(GetTimeRunning - wt <= 0)) then
          begin
            Writeln('  Wait(' + IntToStr(wtB) + ');');
            wt := GetTimeRunning;
          end;
          Writeln('  HoldMouse(' + IntToStr(cx) + ', ' + IntToStr(cy) + ', True);');
          mD := 1;
        end else
          if(not(IMBDL) and (mD = 1)) then
          begin
            if(not(wtB <= 0)) then
            begin
              Writeln('  Wait(' + IntToStr(wtB) + ');');
              wt := GetTimeRunning;
            end;
            Writeln('  ReleaseMouse(' + IntToStr(cx) + ', ' + IntToStr(cy) + ', True);');
            mD := 0;
          end;
        if((IMBDR) and (not(mD = 2))) then
        begin
          if(not(wtB <= 0)) then
          begin
            Writeln('  Wait(' + IntToStr(wtB) + ');');
            wt := GetTimeRunning;
          end;
          Writeln('  HoldMouse(' + IntToStr(cx) + ', ' + IntToStr(cy) + ', False);');
          mD := 2;
        end else
          if(not(IMBDR) and (mD = 2)) then
          begin
            if(not(wtB <= 0)) then
            begin
              Writeln('  Wait(' + IntToStr(wtB) + ');');
              wt := GetTimeRunning;
            end;
            Writeln('  ReleaseMouse(' + IntToStr(cx) + ', ' + IntToStr(cy) + ', False);');
            mD := 0;
          end;
        if(IsFKeyDown(12)) then
          TerminateScript;
      Until(False);
    end.
    Last edited by Daniel; 09-16-2009 at 07:28 PM.
    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 |

  2. #2
    Join Date
    Nov 2008
    Location
    Norway, Alesund
    Posts
    924
    Mentioned
    0 Post(s)
    Quoted
    37 Post(s)

    Default

    great! i will test it right now.

    First Post YAY.!

    EDIT: works great just lags a little bit. but i think after script start tou should do CLS debug (to remove text). (clear it) because now you just cannot CTRL-A (scar advert-news text at the up of debug..)

    SCAR Code:
    //Mouse Macro by Mayazcherquoi (a.k.a Dan's The Man)
    //Records and outputs a SCAR-compatible script of your mouse movements and
    //actions.

    program MouseMacro;

    var
    cx, cy, lx, ly, wt, mD, wtB: Integer;

    procedure ScriptTerminate;
    begin
    Writeln('end.');
    end;

    begin
    ClearDebug;// Laimonas171 EDIT.
    Writeln('program New;');
    Writeln(' //Written by Mouse Macro, which was written by Mayazcherquoi (a.k.a Dan''s The Man)');
    Writeln('begin');
    repeat
    GetMousePos(cx, cy);
    wtB := GetTimeRunning - wt;
    if((cx <> lx) or (cy <> ly)) then
    begin
    if(not(wtB <= 0)) then
    begin
    Writeln(' Wait(' + IntToStr(wtB) + ');');
    wt := GetTimeRunning;
    end;
    Writeln(' MoveMouse(' + IntToStr(cx) + ', ' + IntToStr(cy) + ');');
    lx := cx;
    ly := cy;
    end;
    if(IsMouseButtonDown(True)) then
    begin
    if(mD = 1) then
    Continue;
    if(not(GetTimeRunning - wt <= 0)) then
    begin
    Writeln(' Wait(' + IntToStr(wtB) + ');');
    wt := GetTimeRunning;
    end;
    Writeln(' HoldMouse(' + IntToStr(cx) + ', ' + IntToStr(cy) + ', True);');
    mD := 1;
    end else
    if(IsMouseButtonDown(False)) then
    begin
    if(mD = 2) then
    Continue;
    if(not(wtB <= 0)) then
    begin
    Writeln(' Wait(' + IntToStr(wtB) + ');');
    wt := GetTimeRunning;
    end;
    Writeln(' HoldMouse(' + IntToStr(cx) + ', ' + IntToStr(cy) + ', False);');
    mD := 2;
    end;
    case (mD) of
    1: if(not(IsMouseButtonDown(True))) then
    begin
    if(not(wtB <= 0)) then
    begin
    Writeln(' Wait(' + IntToStr(wtB) + ');');
    wt := GetTimeRunning;
    end;
    Writeln(' ReleaseMouse(' + IntToStr(cx) + ', ' + IntToStr(cy) + ', True);');
    mD := 0;
    end;
    2: if(not(IsMouseButtonDown(False))) then
    begin
    if(not(wtB <= 0)) then
    begin
    Writeln(' Wait(' + IntToStr(wtB) + ');');
    wt := GetTimeRunning;
    end;
    Writeln(' ReleaseMouse(' + IntToStr(cx) + ', ' + IntToStr(cy) + ', False);');
    mD := 0;
    end;
    end;
    Until(False);
    end.

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

    Default

    Erm, i know of ClearDebug and know what it does

    It's just that some people might want to keep their contents Just like the SCAR DFM Form Loader, does it clear the debug lines? No.

    And as for lag, i experience absolutely none. But if you do, you can add a wait(1) at the end of the loop
    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
    Dec 2006
    Location
    Sydney, New South Wales, Australia
    Posts
    4,603
    Mentioned
    15 Post(s)
    Quoted
    42 Post(s)

    Default

    Updated

    Thanks Laimonas for a suggestion which MAY be useful to people
    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 |

  5. #5
    Join Date
    Nov 2008
    Location
    Norway, Alesund
    Posts
    924
    Mentioned
    0 Post(s)
    Quoted
    37 Post(s)

    Default

    Quote Originally Posted by Dan's The Man View Post
    Updated

    Thanks Laimonas for a suggestion which MAY be useful to people
    Np.

  6. #6
    Join Date
    Aug 2007
    Posts
    13
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Cool simple script, might use for some easier tasks in runescape or anything.

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

    Default

    Updated:
    Code:
      - Increased speed significantly
      - There should be ZERO lag now
      - Improved code efficiency
    I see people use this
    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 |

  8. #8
    Join Date
    Aug 2009
    Posts
    242
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Is there anyway to shorten this cuz i made a antiban thing with this and the anti was over 10,000 line
    I see Now, says the blind man

  9. #9
    Join Date
    Sep 2006
    Posts
    15
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thnx man!

  10. #10
    Join Date
    Aug 2009
    Location
    Inside the Matrix...yes it has me, and it has you too.
    Posts
    1,896
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by rya View Post
    Is there anyway to shorten this cuz i made a antiban thing with this and the anti was over 10,000 line
    how the hell......

    edit: yea tried it out, this is pretty cool. good job, rep+
    Last edited by Bionicle; 11-08-2009 at 06:38 PM.
    NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN

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

    Default

    How to make that script reapet again and again?

  12. #12
    Join Date
    Mar 2007
    Location
    Alberta, Canada
    Posts
    1,780
    Mentioned
    0 Post(s)
    Quoted
    11 Post(s)

    Default

    Quote Originally Posted by MaksasMks View Post
    How to make that script reapet again and again?
    repeat
    [Code]
    until(false)

    That would make an endless loop, but I hope you understand.

  13. #13
    Join Date
    Aug 2009
    Location
    Inside the Matrix...yes it has me, and it has you too.
    Posts
    1,896
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Griff721 View Post
    repeat
    [Code]
    until(false)

    That would make an endless loop, but I hope you understand.
    if you want it to go only a certin amount of times, do

    SCAR Code:
    program new;

    Var
    R: Integer;

    begin
      repeat
        Inc(R); //adds one to the integer, it would start as 0 and keep going up each loop by one
        [code]
      Until(R=10); //or what ever number of times you want
    end.
    NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN

  14. #14
    Join Date
    Sep 2006
    Posts
    15
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I forgot everything about Scar. I used the scar before 2007. If u can plz help, I need that very much.
    For example, didn't work:
    Code:
    program New;
      //Written by Mouse Macro, which was written by Mayazcherquoi (a.k.a Dan's The Man)
    
    Var
    R: Integer;
    
    procedure ScriptTerminate;
    begin
      GetSelf.WindowState := wsNormal;
    end;
    
    
    begin
      GetSelf.WindowState := wsMinimized;
      MoveMouse(769, 502);
      HoldMouse(769, 502, True);
      HoldMouse(769, 502, False);
      ReleaseMouse(769, 502, False);
      Wait(50);
      HoldMouse(769, 502, True);
      Wait(100);
      ReleaseMouse(769, 502, True);
      Wait(1022);
      MoveMouse(772, 502);
      Wait(10);
    
    repeat
        Inc(R); //adds one to the integer, it would start as 0 and keep going up each loop by one
      Until(R=10); //or what ever number of times you want
    end.

  15. #15
    Join Date
    Dec 2006
    Location
    @ yard
    Posts
    318
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    So what i understood from this is that this scirpt records mouse movment..

    and Then i can play a scirp and it does a wroted mouse movments again?

    Like record and then play?
    did i get it write?
    i`m here as long as don`t get in the way...

  16. #16
    Join Date
    Sep 2006
    Posts
    15
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yes.

  17. #17
    Join Date
    Oct 2007
    Location
    http://ushort.us/oqmd65
    Posts
    2,605
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    SCAR Code:
    program New;
      //Written by Mouse Macro, which was written by Mayazcherquoi (a.k.a Dan's The Man)

    Var
    R: Integer;

    procedure ScriptTerminate;
    begin
      GetSelf.WindowState := wsNormal;
    end;


    begin
    repeat
      GetSelf.WindowState := wsMinimized;
      MoveMouse(769, 502);
      HoldMouse(769, 502, True);
      HoldMouse(769, 502, False);
      ReleaseMouse(769, 502, False);
      Wait(50);
      HoldMouse(769, 502, True);
      Wait(100);
      ReleaseMouse(769, 502, True);
      Wait(1022);
      MoveMouse(772, 502);
      Wait(10);
        Inc(R); //adds one to the integer, it would start as 0 and keep going up each loop by one
      Until(R=10); //or what ever number of times you want
    end.

    we want it to repeat everything inside the repeat until...
    I do visit every 2-6 months

  18. #18
    Join Date
    Sep 2006
    Posts
    15
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    It works, big thnx for all If that script could write...

  19. #19
    Join Date
    Dec 2006
    Location
    @ yard
    Posts
    318
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    huh yea it works, but in one game i wanted to write mouse, it writes, but when i press to play this mouse movment, it isn`t going accually the same way.. ;/
    its like a large lag or somth..
    i`m here as long as don`t get in the way...

  20. #20
    Join Date
    Oct 2007
    Location
    http://ushort.us/oqmd65
    Posts
    2,605
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    if your using mouse instead of clickmouse, you need to include srl and call setupsrl; right at the beginning of your mainloop.
    I do visit every 2-6 months

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
  •