Results 1 to 17 of 17

Thread: Mouse functions

  1. #1
    Join Date
    Oct 2006
    Location
    Netherlands
    Posts
    3,285
    Mentioned
    105 Post(s)
    Quoted
    494 Post(s)

    Default Mouse functions

    Every time I wrote a script I used the following combination a lot:

    Simba Code:
    GetMousePos(x,y);
    Mouse(x,y,2,2,mouse_Left);

    It is exactly quit an odd piece of code. I wouldn't expect this to be needed to click with barely moving the mouse. Why do I need to declare two integers, which don't even got proper naming in this example, when I don't do anything with them?

    My suggestion?
    Use a TPoint instead of an x and y value for all the mouse functions. So it can look like this:

    Simba Code:
    Mouse(MousePos(),2,2,mouse_Left);

    • The code is shorter.
    • It is self explanatory.
    • It looks clean.
    • It does exactly what is says.
    • And It doesn't involve me declaring two variables called x and y.


    I didn't write the code because I wanted to discuss this idea here and I don't think it really adds something. Discuss!

    edit:
    Maybe we can do this in the lape branch with overloading. That would work so nice.
    Working on: Tithe Farmer

  2. #2
    Join Date
    Feb 2012
    Location
    DON'T PM ME ASKING FOR STUFF
    Posts
    2,170
    Mentioned
    38 Post(s)
    Quoted
    423 Post(s)

    Default

    I've never used GetMousePos(x,y); to be honest

    so would it be

    Simba Code:
    GetMousePos(x,y);
    if MousePos(25, 45) then
    Mouse(MousePos(),2,2,mouse_Left);

    Or something like that?

  3. #3
    Join Date
    Mar 2012
    Posts
    690
    Mentioned
    2 Post(s)
    Quoted
    40 Post(s)

    Default

    Why not just ClickMouse2(True); ? :/

  4. #4
    Join Date
    Oct 2006
    Location
    Netherlands
    Posts
    3,285
    Mentioned
    105 Post(s)
    Quoted
    494 Post(s)

    Default

    Quote Originally Posted by Sirenia View Post
    Why not just ClickMouse2(True); ? :/
    Cause that code is ugly. Also mine still got some random movement in it. Besides this isn't just for GetMousePos. What if you got an array of TPoints and want to check them all? When this function is overloaded in lape you can just do:

    Simba Code:
    if(FindDtms(myDTM, someOtherParams, DTMPoints)) then
      for i := High(DTMPoints) downto 0 do
      begin
        MMouse(DTMPoints[i],5,5);
        if(GetUpText = "MyMonstersName") then
          break;
      end;

    I understand it is not required, but with the option in lape to overload you aren't really loosing anything. You could just add the following to Mouse.simba:
    Simba Code:
    procedure Mouse(MousePoint: TPoint; ranx, rany: Integer; button:Variant); overload;
    begin
      Mouse(MousePoint.x, MousePoint.y, ranx, rany, button);
    end;
    Working on: Tithe Farmer

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

    Default

    Quote Originally Posted by masterBB View Post
    Cause that code is ugly.
    How is it ugly?

    Complete Lape support and abandonment for PascalScript in SRL won't happen for quite some time.
    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 |

  6. #6
    Join Date
    Oct 2006
    Location
    Netherlands
    Posts
    3,285
    Mentioned
    105 Post(s)
    Quoted
    494 Post(s)

    Default

    Quote Originally Posted by Daniel View Post
    How is it ugly?

    Complete Lape support in SRL won't happen for quite some time.
    It doesn't use the SRL 5 mouse constants. You can't make it use the middle mouse button. It doesn't say where it clicks in the name. I believe the 2 is added just because ClickMouse already existed.

    edit:
    I thought Nielsie his SRL branch would become the main branch in some time?
    Last edited by masterBB; 05-02-2012 at 08:29 AM.
    Working on: Tithe Farmer

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

    Default

    Quote Originally Posted by masterBB View Post
    It doesn't say where it clicks in the name. I believe the 2 is added just because ClickMouse already existed.
    You have MoveMouse which moves the mouse, and ClickMouse which clicks the mouse? Mouse if you want to move + click, MMouse to just move, and ClickMouse2 to just 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 |

  8. #8
    Join Date
    Oct 2006
    Location
    Netherlands
    Posts
    3,285
    Mentioned
    105 Post(s)
    Quoted
    494 Post(s)

    Default

    Quote Originally Posted by Daniel View Post
    You have MoveMouse which moves the mouse, and ClickMouse which clicks the mouse? Mouse if you want to move + click, MMouse to just move, and ClickMouse2 to just click.
    Never mind about the srl constants part:P Didn't know that it also supported Boolean. But why is that 2 there? Still want mouse functions with TPoint as an option when srl goes full lape.
    Working on: Tithe Farmer

  9. #9
    Join Date
    Nov 2011
    Posts
    1,589
    Mentioned
    9 Post(s)
    Quoted
    17 Post(s)

    Default

    I Use MMMouse then a small wait then click, but its personal preference :P



    ^^

  10. #10
    Join Date
    Nov 2006
    Posts
    2,369
    Mentioned
    4 Post(s)
    Quoted
    78 Post(s)

    Default

    Actually your method is currently quite detectable as it can only move mouse right and down. Try this
    GetMousePos(x,y);
    Mouse(x-1,y-1,3,3,mouse_Left);

    I wish pascal/simba supported function overloading. Then we could have multiple procedures called "Mouse" where the only difference is the parameters.
    Quote Originally Posted by DeSnob View Post
    ETA's don't exist in SRL like they did in other communities. Want a faster update? Help out with updating, otherwise just gotta wait it out.

  11. #11
    Join Date
    Oct 2006
    Location
    Netherlands
    Posts
    3,285
    Mentioned
    105 Post(s)
    Quoted
    494 Post(s)

    Default

    I got the feeling not everyone understands that I do not want to write a different mouse function. Just change the x and y integer parameters to one TPoint, preferably by overloading. But can also be done by creating function clones like this:
    Simba Code:
    procedure MousePoint(MousePoint: TPoint; ranx, rany: Integer; button:Variant);
    begin
      Mouse(MousePoint.x, MousePoint.y, ranx, rany, button);
    end;


    Quote Originally Posted by weequ View Post
    Actually your method is currently quite detectable as it can only move mouse right and down. Try this
    GetMousePos(x,y);
    Mouse(x-1,y-1,3,3,mouse_Left);

    I wish pascal/simba supported function overloading. Then we could have multiple procedures called "Mouse" where the only difference is the parameters.
    Might be tackled with this:

    Simba Code:
    procedure Mouse(MousePoint: TPoint; ranx, rany: Integer; button:Variant); overload;
    begin
      Mouse(MousePoint.x-ranx, MousePoint.y-rany, ranx, rany, button);
    end;

    But maybe it would be better to change in the regular mouse method, oh well.
    Working on: Tithe Farmer

  12. #12
    Join Date
    Mar 2012
    Posts
    690
    Mentioned
    2 Post(s)
    Quoted
    40 Post(s)

    Default

    Quote Originally Posted by masterBB View Post
    Never mind about the srl constants part:P Didn't know that it also supported Boolean. But why is that 2 there? Still want mouse functions with TPoint as an option when srl goes full lape.
    Normal clicmouse clicks the mouse super fast and holds down the mouse like 1 milisec, clicmouse2 holds down the mouse alittle longer and with randomness

  13. #13
    Join Date
    Dec 2006
    Location
    Sweden
    Posts
    10,812
    Mentioned
    3 Post(s)
    Quoted
    16 Post(s)

    Default

    Mouse with randomness will do a little "jitter". I don't like it personally. Unsure why it does it, but looks bad.


    Send SMS messages using Simba
    Please do not send me a PM asking for help; I will not be able to help you! Post in a relevant thread or make your own! And always remember to search first!

  14. #14
    Join Date
    Aug 2008
    Location
    London, UK
    Posts
    456
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    In my opinion you shouldn't use any randomness after grabbing the mouse position. Clickmouse2 is an awful name though.

  15. #15
    Join Date
    Oct 2011
    Location
    UK
    Posts
    1,322
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by ReadySteadyGo View Post
    In my opinion you shouldn't use any randomness after grabbing the mouse position. Clickmouse2 is an awful name though.
    Yeah you would look very bot like shifting a couple of pixels just before you click every time you do

  16. #16
    Join Date
    Feb 2012
    Location
    Somewhere, over the rainbow...
    Posts
    2,272
    Mentioned
    3 Post(s)
    Quoted
    45 Post(s)

    Default

    Support. I would personally love to see TPoints replacing x and y as it has more uses.

    Quote Originally Posted by Harry View Post
    Mouse with randomness will do a little "jitter". I don't like it personally. Unsure why it does it, but looks bad.
    Would it be possible to do:
    Simba Code:
    GetMousePos(x, y);
    xe := x + Random(4); // add randomness before moving
    ye := y + Random(4);
    Mouse(xe, ye, 0, 0, True);
    To remove that 'jitter'?

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

    Default

    Op wants:

    MMouse(TPoint, RandomX, RandomY);

    or

    MMouse(TPoint, TPoint);

    or

    ClickMouse(TPoint, MOUSE_ACTION);

    or

    GetMousePos(TPoint);

    See? No X, Y parameters. Instead it takes a TPoint. Also what he's saying is that instead of having so many mouse functions it'd be cool if you could overload them so that one function can take various parameters and do that many things. His lape was just an example.

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
  •