"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