New to AutoIT need help with random mouse clicks menu

User Tag List

Results 1 to 7 of 7
  1. #1
    Eaassas's Avatar Member
    Reputation
    3
    Join Date
    Jan 2009
    Posts
    141
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    New to AutoIT need help with random mouse clicks

    I bought a secondary account which I will use to learn how to make scripts while I am at work and was wondering if anyone has some must read for this?

    I mostly want to learn how to make my scripts do mouse clicks that are seemingly similar but will click on different places on the screen each time so it doesnt keep clicking the same spots over and over (I think like NotAres gold farming bot does)

    Can anyone help me figure out how to do that?

    New to AutoIT need help with random mouse clicks
  2. #2
    Ludowitsch's Avatar Member
    Reputation
    2
    Join Date
    Jan 2012
    Posts
    19
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    By using something like this:

    Code:
    $x_click = 800
    $y_click = 600
    
    $x_deviation = 10
    $y_deviation = $x_deviation
    
    $x_random = Random($x_click - $x_deviation, $x_click + $x_deviation, 1)
    $y_random = Random($y_click - $y_deviation, $y_click + $y_deviation, 1)
    
    MouseClick("primary", $x_random, $y_random)
    $x_click and $y_click are the coordinates at which you want to click
    $x_deviation and $y_deviation together with the aforementioned variables are used by the Random() function as values within which Random() should pick a random integer value.
    The two rolled values are stored in $x_random and $y_random and used by MouseClick().
    Last edited by Ludowitsch; 06-11-2012 at 12:11 PM.

  3. #3
    Shimizoki's Avatar Knight-Lieutenant
    Reputation
    32
    Join Date
    Jun 2012
    Posts
    358
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Or you could set up a function

    Code:
    Func RandomClick($click_type="left", $x_click, $y_click, $x_deviation=10, $y_deviation=10, $click_speed=10)
        $x_random = Random($x_click - $x_deviation, $x_click + $x_deviation)
        $y_random = Random($y_click - $y_deviation, $y_click + $y_deviation)
    
        MouseClick($click_type, $x_random, $y_random, $click_speed)
    EndFunc
    This can be called as
    Code:
    RandomClick(400, 600) ;Left clicks at 400,600 with deviation of 10 at speed 10
    RandomClick("right", 400, 600) ;Right clicks at 400,600 with deviation of 10 at speed 10
    RandomClick(400, 600, 15, 20) ;Left clicks at 400,600 with deviation of x=15 and y=20 at speed 10

  4. #4
    Ludowitsch's Avatar Member
    Reputation
    2
    Join Date
    Jan 2012
    Posts
    19
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    "Primary" and "secondary" instead of "left" and "right" become important on systems where the users have switched left and right mouse buttons, e.g. on systems used by Lefties. Also you can't switch the order of or leave away parameters when calling a function. Yours expects the mouse button to be used as the first parameter, so telling it a screen coordinate instead will make it fail. Here's a corrected version:

    Code:
    RandomClick("", 400, 600);left clicks at 400,600 with deviation of 10 at speed 10; ignoring swapped mouse buttons
    RandomClick("primary", 400, 600) ;primary clicks at 400,600 with deviation of 10 at speed 10; taking into consideration whether or not mouse buttons are switched
    RandomClick("secondary", 400, 600, 10, 10, 20) ;secondary clicks at 400,600 with deviation of 10 for both axes at speed 20
    RandomClick("", 400, 600, 15, 20) ;Moves the mouse pointer to 400,600 with deviation of x=15 and y=20 at speed 10
    
    Func RandomClick($click_type, $x_click, $y_click, $x_deviation = 10, $y_deviation = 10, $click_speed = 10)
    	$click_type = StringLower($click_type)
    	If Not ($click_type = "primary") And Not ($click_type = "secondary") And Not ($click_type = "") Then
    		Return (-1); return -1 if user has entered something unexpected as the mouse button to be used
    	EndIf
    
    	$x_random = Random($x_click - $x_deviation, $x_click + $x_deviation)
    	$y_random = Random($y_click - $y_deviation, $y_click + $y_deviation)
    
    	MouseClick($click_type, $x_random, $y_random, $click_speed)
    EndFunc   ;==>RandomClick

  5. #5
    Workas's Avatar Sergeant
    Reputation
    10
    Join Date
    Jun 2012
    Posts
    37
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is all that function just to make it work for swapping mouse?
    Last edited by Workas; 06-10-2012 at 02:50 PM.

  6. #6
    Shimizoki's Avatar Knight-Lieutenant
    Reputation
    32
    Join Date
    Jun 2012
    Posts
    358
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    @Ludowitsch

    Thanks, I goofed and didnt put the initial "" for the first parameter. However I did not know about the Primary vs Secondary. Thanks for that.

  7. #7
    Ludowitsch's Avatar Member
    Reputation
    2
    Join Date
    Jan 2012
    Posts
    19
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I messed up the script in my first posting too, confusing MouseMove() parameters with MouseClick(). It's fixed now.


    Also,
    Originally Posted by Workas View Post
    Is all that function just to make it work for swapping mouse?
    Originally Posted by Eaassas View Post
    random mouse clicks

Similar Threads

  1. [AutoIT]- Need Help with 2 Offsets
    By jabbaruh in forum WoW Memory Editing
    Replies: 18
    Last Post: 07-04-2009, 04:14 PM
  2. New to LUA need help with script
    By nickelo in forum World of Warcraft Emulator Servers
    Replies: 4
    Last Post: 06-30-2008, 01:34 PM
  3. New Private Server - Need Help with Scripting Please
    By Xerxe in forum World of Warcraft Emulator Servers
    Replies: 3
    Last Post: 04-14-2008, 09:02 AM
  4. [Help] New to LUA, Need help with script.
    By nickelo in forum World of Warcraft Emulator Servers
    Replies: 2
    Last Post: 03-14-2008, 11:23 PM
  5. Need help with Chrispee's new repack
    By endlessbounty in forum WoW EMU Guides & Tutorials
    Replies: 1
    Last Post: 11-12-2007, 02:08 PM
All times are GMT -5. The time now is 08:53 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search