Results 1 to 18 of 18

Thread: Mouse hold down question

  1. #1
    Join Date
    Jan 2010
    Location
    U.S.
    Posts
    72
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Mouse hold down question

    EDIT: Narrowed it down for new readers.

    Code:
    procedure Spell;
    begin
    repeat
      MoveMouse(640, 622);
      ClickMouse(666, 624, True);
      Wait(4 * 2000);
      MoveMouse(526, 622);
      ClickMouse(523, 621, True);
      Wait(6 * 1000);
    until(false)
    end;
    
    procedure SpellWait;
    begin
      HoldMouse(50, 50, True);
      Wait(5 * 1000);
      ReleaseMouse(150, 150, True);
    end;
    
    begin
      repeat
        Spell;
        SpellWait;
        Wait(5 * 60 * 1000);
      until(False);
    end.
    Under the procedure 'spell' I need to know instead of (false) which is never ending to be a time limit. Would until(50000) work? or is there more math involved?
    Last edited by Littma; 01-24-2010 at 04:43 PM.

  2. #2
    Join Date
    Dec 2008
    Posts
    209
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    instead of using mousemove/clickmouse couldn't you just use mouse?

    and just press F1 in SCAR for SCAR manual and help -> SRL Manual for SRL's manual.

    procedure HoldMouse(x, y: Integer; Left: Boolean);
    Holds mouse button. Set parameter Left to true for left button, false for right.

    procedure MMouse(x, y, rx, ry: integer);
    By: Benland100
    Description:
    Moves the mouse.

    procedure ReleaseMouse(x, y: Integer; Left: Boolean);
    Releases mouse button. Set parameter Left to true for left button, false for right.
    PHP Code:
    program blah;

    {.include 
    SRL/SRL.scar}

    begin
      HoldMouse
    (5050True);
      
    ReleaseMouse(150150True);
    end
    I think It'd be somewhat like that ^

  3. #3
    Join Date
    Oct 2009
    Location
    Stockton, CA
    Posts
    2,040
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    procedure HoldMouse(x, y: Integer; Left: Boolean);
    Holds mouse button. Set parameter Left to true for left button, false for right.
    procedure ReleaseMouse(x, y: Integer; Left: Boolean);
    Releases mouse button. Set parameter Left to true for left button, false for right.


    In regards of your second question;
    SCAR Code:
    function IAmAFunction : string;
    begin
      result := 'wat';
    end;
    procedure IAmAProcedure;
    begin
      writeln('IAmAProcedure ran.');
    end;
    begin
      Writeln(IAmAFunction);
      Writeln(IAmAProcedure);
    end.
    Join the IRC! irc.rizon.net:6667/srl | SQLite (0.99rc3+) | SRL Doc | Simba Doc | Extra Simba Libraries (openSSL & sqlite3)
    Quote Originally Posted by #srl
    10:45 < Toter> daphil when can get sex anyday I want
    10:45 < Toter> he is always on #SRL
    "A programmer is just a tool which converts caffeine into code"

  4. #4
    Join Date
    May 2007
    Location
    Ohio
    Posts
    2,296
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    program FlashGame;

    procedure MouseStuff;
    begin
      repeat
        MoveMouse(640, 622);
        ClickMouse(666, 624, True);
        Wait(8000 + Random(500))
        MoveMouse(526, 622);
        ClickMouse(523, 621, True);
        Wait(6000 + Random(500))
      until(false)
    end;

    begin
      MouseStuff;
    end.
    Then,
    SCAR Code:
    Procedure HoldMouse(x: LongInt; y: LongInt; Left: Boolean)//is the procedure
    use it like...
    SCAR Code:
    procedure Something;
    var
      x, y: Integer;
    begin
      GetMousePos(x, y);
      HoldMouse(x, y, True);//Holds Left
      HoldMouse(x, y, False);//Holds Right
      Wait({some milliseconds here});
      ReleaseMouse(x, y, True);//Releases Left
      ReleaseMouse(x, y, False);//Releases Right
    end;

    begin
      Something;
    end.

  5. #5
    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

    Just wanted to say...if your planing on using this for scripting in runescape, ClickMouse is very detectable, as the time between the holding and the releasing of the mouse is too small for any normal human to be able to do. If you are going to use HoldMouse and ReleaseMouse then put in a good wait in between with some random too so it will be less detectable.

    EDIT:
    Quote Originally Posted by Littma View Post
    I've been using a basic script that I've made for a flash game
    nvm
    NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN

  6. #6
    Join Date
    Feb 2007
    Location
    Access Violation at 0x00000000
    Posts
    2,865
    Mentioned
    3 Post(s)
    Quoted
    18 Post(s)

    Default

    Quote Originally Posted by Sex View Post
    procedure HoldMouse(x, y: Integer; Left: Boolean);
    Holds mouse button. Set parameter Left to true for left button, false for right.
    procedure ReleaseMouse(x, y: Integer; Left: Boolean);
    Releases mouse button. Set parameter Left to true for left button, false for right.


    In regards of your second question;
    SCAR Code:
    function IAmAFunction : string;
    begin
      result := 'wat';
    end;
    procedure IAmAProcedure;
    begin
      writeln('IAmAProcedure ran.');
    end;
    begin
      Writeln(IAmAFunction);
      Writeln(IAmAProcedure);
    end.
    that will errorr... (the procedure) the you can't writeln(writeln()));
    instead; use:
    SCAR Code:
    function IAmAFunction : string;
    begin
      result := 'wat';
    end;

    procedure IAmAProcedure;
    begin
      writeln('IAmAProcedure ran.');
    end;

    begin
      Writeln(IAmAFunction);
      IAmAProcedure;
    end.
    Ce ne sont que des gueux


  7. #7
    Join Date
    Jan 2010
    Location
    U.S.
    Posts
    72
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Craig` View Post
    instead of using mousemove/clickmouse couldn't you just use mouse?

    and just press F1 in SCAR for SCAR manual and help -> SRL Manual for SRL's manual.



    PHP Code:
    program blah;

    {.include 
    SRL/SRL.scar}

    begin
      HoldMouse
    (5050True);
      
    ReleaseMouse(150150True);
    end
    I think It'd be somewhat like that ^
    I've tried using Mouse, though having trouble with the whole syntax of the Mouse command. Seems to return in quite a bit of errors which I do not understand. It's been roughly a year since I've scripted in S.C.A.R which makes it quite difficult to re-learn. I appreciate your help, I will give it a shot

    @Sex
    Thank you as well for your response, I'll take your advice along with Craig`s advice and give the results. Thank you as well for giving me that example, kicked in knowledge I totally forgot.

    As a result of both of your efforts, I have narrowed it down.

    Code:
    program New;
    begin
    procedure spell;
    repeat
    movemouse(640, 622);
    clickmouse(666, 624,true);
    wait(8000+random(500))
    movemouse(526, 622);
    clickmouse(523, 621,true);
    wait(6000+random(500))
    until(false)
    end.
    
    Procedure spellwait;
    begin
    HoldMouse(50, 50, True);
    ReleaseMouse(150, 150, True);
    end.
    
    begin
    Writeln(spell);
    Writeln(spellwait);
    end.
    It seems good. Though I'm stumped on one last thing, I'd like the procedure 'spellwait' to run after five minutes or somewhere close to it. Would a simple wait(500000) run the procedure after the begin under the procedure 'spellwait'? Or would it also work at the bottom of the script where it says to run the procedures to put a wait(500000) or so it will run the procedure 'spell' then after 500000ms would run 'spellwait'

    Though, I am questioned since I have the procedure 'spell' under a never ending loop its bound to just continue 'spellwait' until 'spell' is finished, which in this case it would never be finished. Any advice?

  8. #8
    Join Date
    Feb 2007
    Location
    Access Violation at 0x00000000
    Posts
    2,865
    Mentioned
    3 Post(s)
    Quoted
    18 Post(s)

    Default

    You are making a tiny mistake here! Wait(500000); waits 500000 MILLISECONDS -> 500 seconds != 5 minutes.
    Do:
    Wait(5 * 60 * 1000);

    Also, Sex made a small mistake which taught you wrong. You don't have to WriteLn a procedure
    SCAR Code:
    program New;

    //these procedures are just things that you make so the MAIN loop can use them, if they aren't put in the main loop they will never do anything
    procedure spell;
    begin
      movemouse(640, 622);
      clickmouse(666, 624,true);
      wait(8000+random(500))
      movemouse(526, 622);
      clickmouse(523, 621,true);
      wait(6000+random(500))
    end.

    procedure spellwait;
    begin
      HoldMouse(50, 50, True);
      ReleaseMouse(150, 150, True);
    end.

    //... this is the main loop, the code that will actually be executed
    begin
      repeat
        spell;
        spellwait;
        wait(5 * 60 * 1000);
      until(false);
    end.
    Last edited by Floor66; 01-24-2010 at 03:24 PM.
    Ce ne sont que des gueux


  9. #9
    Join Date
    Jan 2010
    Location
    U.S.
    Posts
    72
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by bionicle1800 View Post
    Just wanted to say...if your planing on using this for scripting in runescape, ClickMouse is very detectable, as the time between the holding and the releasing of the mouse is too small for any normal human to be able to do. If you are going to use HoldMouse and ReleaseMouse then put in a good wait in between with some random too so it will be less detectable.

    EDIT:
    nvm
    Yeah - I used to script a little in S.C.A.R back in 07, took a break and started back in 08 and have not scripted in it since. I never made anything amazing, and never would use ClickMouse/MoveMouse for any RuneScape scripts (unless I was botting in 05' where it wouldn't matter as much) Though for some flash game, it really doesn't matter since the game is still in BETA and bound to have a 0% ban rate since they don't have a Macro Detection System.

  10. #10
    Join Date
    Jan 2010
    Location
    U.S.
    Posts
    72
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Floor66 View Post
    You are making a tiny mistake here! Wait(500000); waits 500000 MILLISECONDS -> 500 seconds != 5 minutes.
    Do:
    Wait(5 * 60 * 1000);
    Oh! Thank you. Though still a question, instead of a constant loop what would be the Until(???) string be to run for 5 or so minutes out of curiosity. Knowing if I run the procedure that has a constant never ending loop, it would not run the second procedure knowing the first one would not end what so ever. Any advice?

  11. #11
    Join Date
    Feb 2007
    Location
    Access Violation at 0x00000000
    Posts
    2,865
    Mentioned
    3 Post(s)
    Quoted
    18 Post(s)

    Default

    read up, i edited my post
    Ce ne sont que des gueux


  12. #12
    Join Date
    Jan 2010
    Location
    U.S.
    Posts
    72
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Floor66 View Post
    read up, i edited my post
    Testing it now, it looks GREAT!
    Much better than what I had.
    A quick overview on
    HoldMouse(50, 50, True);
    ReleaseMouse(150, 150, True);
    Just so I can understand this.
    HoldMouse(x,y,true); so it holds down the left button on the specified x,y cords, and on ReleaseMouse(150, 150,True); this would release the mouse after 150 milliseconds? Just out of curiosity shouldn't there be a wait in between?

  13. #13
    Join Date
    Feb 2007
    Location
    Access Violation at 0x00000000
    Posts
    2,865
    Mentioned
    3 Post(s)
    Quoted
    18 Post(s)

    Default

    HoldMouse(x, y, True); holds the left mouse button at x, y
    ReleaseMouse(150, 150, True); releases the left mouse button at 150, 150

    I would advise you to indeed put a wait inbetween, this should work:
    SCAR Code:
    program New;

    //these procedures are just things that you make so the MAIN loop can use them, if they aren't put in the main loop they will never do anything
    procedure Spell;
    begin
      MoveMouse(640, 622);
      ClickMouse(666, 624, True);
      Wait(8000 + Random(500));
      MoveMouse(526, 622);
      ClickMouse(523, 621, True);
      Wait(6000 + Random(500));
    end.

    procedure SpellWait;
    begin
      HoldMouse(50, 50, True); //holds the left mouse btn at coordinates 50, 50
      Wait(5 * 1000); //waits 5 seconds (5 times 1000 milliseconds, 1000ms = 1sec), change to whatever you want
      ReleaseMouse(150, 150, True); //releases the left mouse btn at coordinates 150, 150
    end.

    //... this is the main loop, the code that will actually be executed
    begin
      repeat
        Spell;
        SpellWait;
        Wait(5 * 60 * 1000);
      until(False);
    end.
    Last edited by Floor66; 01-24-2010 at 03:44 PM.
    Ce ne sont que des gueux


  14. #14
    Join Date
    Jan 2010
    Location
    U.S.
    Posts
    72
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Floor66 View Post
    HoldMouse(x, y, True); holds the left mouse button at x, y
    ReleaseMouse(150, 150, True); releases the left mouse button at 150, 150

    I would advise you to indeed put a wait inbetween.
    Alright, so basically it holds down the button on the x,y cords and releases at the cords of 150, 150 correct? Meaning I could change the x,y values to HoldMouse to 50, 50 along with the cords of ReleaseMouse to 50, 50 as an example which would hold down the mouse button at 50, 50 for an x amount of time of the wait between the two strings correct?

  15. #15
    Join Date
    Feb 2007
    Location
    Access Violation at 0x00000000
    Posts
    2,865
    Mentioned
    3 Post(s)
    Quoted
    18 Post(s)

    Default

    sorry for my sloppy editing read up plx, added code with comments
    Ce ne sont que des gueux


  16. #16
    Join Date
    Jan 2010
    Location
    U.S.
    Posts
    72
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Floor66 View Post
    sorry for my sloppy editing read up plx, added code with comments
    Thanks for the update. Last thing I believe I need is a command for the procedure Spell

    Code:
    program New;
    
    //these procedures are just things that you make so the MAIN loop can use them, if they aren't put in the main loop they will never do anything
    procedure Spell;
    begin
      MoveMouse(640, 622);
      ClickMouse(666, 624, True);
      Wait(8000 + Random(500));
      MoveMouse(526, 622);
      ClickMouse(523, 621, True);
      Wait(6000 + Random(500));
    end.
    
    procedure SpellWait;
    begin
      HoldMouse(50, 50, True); //holds the left mouse btn at coordinates 50, 50
      Wait(5 * 1000); //waits 5 seconds (5 times 1000 milliseconds, 1000ms = 1sec), change to whatever you want
      ReleaseMouse(150, 150, True); //releases the left mouse btn at coordinates 150, 150
    end.
    
    //... this is the main loop, the code that will actually be executed
    begin
      repeat
        Spell;
        SpellWait;
        Wait(5 * 60 * 1000);
      until(False);
    end.
    The way I see this is it will do Spell, then SpellWait. Though what I need is SpellWait to go in effect after 5 or so minutes which putting in a loop for x amount of time would fix that problem for the Spell procedure. Any tips on how to fix that one problem? Thanks in advance.

    As in
    Code:
    procedure Spell
    begin
    repeat
      MoveMouse(640, 622);
      ClickMouse(666, 624, True);
      Wait(8000 + Random(500));
      MoveMouse(526, 622);
      ClickMouse(523, 621, True);
      Wait(6000 + Random(500));
    until(false)
    end.
    Instead of the false integer, what would be the command for it to loop for x amount of time? This is so it can do the Spell procedure for an x amount of time then move on to the SpellWait procedure then loop the script once again.
    Last edited by Littma; 01-24-2010 at 04:26 PM.

  17. #17
    Join Date
    Feb 2007
    Location
    Access Violation at 0x00000000
    Posts
    2,865
    Mentioned
    3 Post(s)
    Quoted
    18 Post(s)

    Default

    This then?
    SCAR Code:
    program New;

    var
      i, t : Integer;

    //these procedures are just things that you make so the MAIN loop can use them, if they aren't put in the main loop they will never do anything
    procedure Spell;
    begin
      repeat
        MoveMouse(640, 622);
        ClickMouse(666, 624, True);
        Wait(8000 + Random(500));
        MoveMouse(526, 622);
        ClickMouse(523, 621, True);
        Wait(6000 + Random(500));
        Inc(i);
      until(i = 5); //change 5 to any number, the loop will repeat this many times
    end.

    procedure SpellWait;
    begin
      t := GetSystemTime;
      HoldMouse(50, 50, True);
      while (GetSystemTime - t) <= (5 * 60 * 1000) do
        Wait(10); //the mouse will be held down for 5 minutes now
      ReleaseMouse(150, 150, True);
    end.

    //... this is the main loop, the code that will actually be executed
    begin
      repeat
        Spell;
        SpellWait;
      until(False);
    end.
    Ce ne sont que des gueux


  18. #18
    Join Date
    Jan 2010
    Location
    U.S.
    Posts
    72
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Floor66 View Post
    This then?
    SCAR Code:
    program New;

    var
      i, t : Integer;

    //these procedures are just things that you make so the MAIN loop can use them, if they aren't put in the main loop they will never do anything
    procedure Spell;
    begin
      repeat
        MoveMouse(640, 622);
        ClickMouse(666, 624, True);
        Wait(8000 + Random(500));
        MoveMouse(526, 622);
        ClickMouse(523, 621, True);
        Wait(6000 + Random(500));
        Inc(i);
      until(i = 5); //change 5 to any number, the loop will repeat this many times
    end.

    procedure SpellWait;
    begin
      t := GetSystemTime;
      HoldMouse(50, 50, True);
      while (GetSystemTime - t) <= (5 * 60 * 1000) do
        Wait(10); //the mouse will be held down for 5 minutes now
      ReleaseMouse(150, 150, True);
    end.

    //... this is the main loop, the code that will actually be executed
    begin
      repeat
        Spell;
        SpellWait;
      until(False);
    end.
    Lifesaver.
    It worked.
    I highly appreciate this and everyones time put in to helping.
    Thank you once again, I was reading a tut on loops and forgot the t integer.
    Thanks again guys!

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
  •