Results 1 to 5 of 5

Thread: How to make a random mouse click in a little selected square?

  1. #1
    Join Date
    Oct 2014
    Location
    Belgium
    Posts
    33
    Mentioned
    0 Post(s)
    Quoted
    9 Post(s)

    Default How to make a random mouse click in a little selected square?

    so i manged to do this....

    this is what i made so far

    program Whine_Grabber;

    {$I SRL-6/SRL.simba} // Be sure to add this to ALL your scripts!

    Procedure Whine_Grabber

    Var

    Wine_Of_Zamorak :Integer;

    X, y:Integer;


    begin
    //This is the DTM of the wine
    Wine_Of_Zamorak:= DTMFromString('m1gAAAHic42JgYGhlZGBoBOJeIO4D4n4g7g LiOiAuBeJiIK4A4plAte1A3AXEE4F4BhAvBeJlQDwXiKcA8QQg 1lJTY8hOTGBwtrVliAgIYGirrGSwMTNj4GRnZxAWFGQwNzRkSI mOZhABqiUGMxKJEQAA3+kTVA==');

    if
    FindDTM(Wine_Of_Zamorak, x, y, 332, 120, 438, 195) then // Looking Location of the wine


    // starting this when we find the wine
    Begin

    mouse(point(x, y), MOUSE_MOVE, MOUSE_HUMAN); //Moving to wine

    mouse(point(x, y), MOUSE_Left, MOUSE_HUMAN); //Clicking on the wine

    wait(random(3400, 5020)); //Random wait between a and b ms

    mouse(point(692, 277), MOUSE_MOVE, MOUSE_HUMAN); //Moving to telegrab Icon I WHANT TO CLICK RANDOMLY TO THIS SO I DONT CLICK ALWAYS ON THE SAME PIXEL

    Wait(random(1200, 1600)); //Random wait between a and b ms

    mouse(point(692, 277), MOUSE_Left, MOUSE_HUMAN); //Clicking on telegrab Icon I WHANT TO CLICK RANDOMLY TO THIS SO I DONT CLICK ALWAYS ON THE SAME PIXEL

    Wait(random(1200, 1600)); //Random wait between a and b ms

    mouse(point(379, 185), MOUSE_MOVE, MOUSE_HUMAN); //Moving back to the spawn location of the wine

    FreeDTM(Wine_Of_Zamorak); // freeDTM so idk why this is needed.....

    end;

    end;
    Begin

    Repeat

    Whine_Grabber;

    until(False);

    end.

  2. #2
    Join Date
    Aug 2016
    Location
    Kentucky
    Posts
    253
    Mentioned
    3 Post(s)
    Quoted
    96 Post(s)

    Default

    I believe the randomrange(min, max) function may be what you're looking for.
    So you could use for example
    mouse(point(690 + randomrange(1, 5), 275 + randomrange(1, 5)), MOUSE_MOVE, MOUSE_HUMAN);

    I haven't touched Simba in quite a while, so I'm not sure if that formatting is correct.

    you could also generate the random number of x and y before hand, each loop though, and plug in the variables into the mouse function.
    Simba Code:
    ranx := randomRange(690, 695);
    rany := randomRange(275, 280);
    mouse(point(ranx, rany), MOUSE_MOVE, MOUSE_HUMAN);
    Last edited by Aspect; 04-08-2018 at 07:20 PM.

  3. #3
    Join Date
    Oct 2014
    Location
    Belgium
    Posts
    33
    Mentioned
    0 Post(s)
    Quoted
    9 Post(s)

    Default

    Thank you for the reply

    Yoopi told me in teh chat to use these and it works great.

    this is what yoopi said to me. mouse(random(690, 694), random(275, 279), MOUSE_MOVE, MOUSE_HUMAN);

  4. #4
    Join Date
    Mar 2013
    Location
    Argentina
    Posts
    758
    Mentioned
    27 Post(s)
    Quoted
    365 Post(s)

    Default

    Quote Originally Posted by RSPS Scripter View Post
    Thank you for the reply

    Yoopi told me in teh chat to use these and it works great.

    this is what yoopi said to me. mouse(random(690, 694), random(275, 279), MOUSE_MOVE, MOUSE_HUMAN);
    Try putting code in [SIMBA] Code, you can find it in Advanced. It makes it way easier to read
    Formerly known as Undorak7

  5. #5
    Join Date
    Dec 2006
    Location
    Program TEXAS home of AUTOERS
    Posts
    7,937
    Mentioned
    26 Post(s)
    Quoted
    235 Post(s)

    Default

    You can also use MouseBox:
    Simba Code:
    MouseBox(x1, y1, x2, y2: Integer; ClickType: Integer);
    Moves mouse into a random position in the box. Clicks if told to.


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
  •