iZafiro Posted September 2, 2006 Share Posted September 2, 2006 Hmm. I'm making an autoclicker. Yay i can get it to click 3000+ times a second (i used a downloaded program to calculate the clicks per second the clicking part of my script is (dont run this script by itself... it'll just keep clicking and wont stop... add a terminate function yourself) $clicks = 0 ;all my gui scripts... $clickspeed = GUICtrlCreateInput($clicks,"[position]","[position]",$ES_READONLY);just a 'status info' thingy ;all my other gui scrips... $x = 1 While 1 If $x = 2 Then $a = TimerInit() MouseDown("left") $b = TimerDiff($a) $clicks = 1000/$b EndIf WEnd ;function to start/stop/exit Okay, then now $clicks = 1000/$b right? but since my read-only input panel is rendered right on top, even when it starts clicking, it will still be zero. any ideas how to fix this? (sorry for the lame questions, im a newbie... just learned the script yesterday. (OMG 1 day learn script YAY)) Thanks in advance, iZafiro Link to comment Share on other sites More sharing options...
Paulie Posted September 2, 2006 Share Posted September 2, 2006 Hmm. I'm making an autoclicker. Yay i can get it to click 3000+ times a second (i used a downloaded program to calculate the clicks per second the clicking part of my script is (dont run this script by itself... it'll just keep clicking and wont stop... add a terminate function yourself) $clicks = 0 ;all my gui scripts... $clickspeed = GUICtrlCreateInput($clicks,"[position]","[position]",$ES_READONLY);just a 'status info' thingy ;all my other gui scrips... $x = 1 While 1 If $x = 2 Then $a = TimerInit() MouseDown("left") $b = TimerDiff($a) $clicks = 1000/$b EndIf WEnd ;function to start/stop/exit Okay, then now $clicks = 1000/$b right? but since my read-only input panel is rendered right on top, even when it starts clicking, it will still be zero. any ideas how to fix this? (sorry for the lame questions, im a newbie... just learned the script yesterday. (OMG 1 day learn script YAY)) Thanks in advance, iZafiro Have you read the helpfile for mouseclick? it contans the "clicks" parameter, so one can define how many click it should send Link to comment Share on other sites More sharing options...
iZafiro Posted September 3, 2006 Author Share Posted September 3, 2006 Yes, but I want to measure the clicks per second (1000/how long the script takes to run) And, I want to set the clicks per second..... not how many clicks it gives... I mean like if the script takes 200 milliseconds to run, then there will only be 5 clicks per second... So i am thinking of finding out how long the script takes to run, then have an input panel ($clickspeed) clicks per second, then sleep((1000/$clickspeed)-how long script takes to run) somewhere. anyideas? Link to comment Share on other sites More sharing options...
Azu Posted September 3, 2006 Share Posted September 3, 2006 Hi. Set the amount of clicks to how many clicks per second you want, and put it in a loop with a sleep(1000) Link to comment Share on other sites More sharing options...
jvanegmond Posted September 3, 2006 Share Posted September 3, 2006 (edited) Look at this, it's your code:$x = 1 While 1 [True] If $x = 2 [False] Then;Always FALSE!! $a = TimerInit() MouseDown("left") $b = TimerDiff($a) $clicks = 1000/$b EndIf WEndThis is the same as:While 1 WendEdit: If you want to get exactly so many clicks/second you have to calculate the clicks/second and compare it to what you want, and then add or substract x from number that determines how fast you give a click. Edited September 3, 2006 by Manadar github.com/jvanegmond Link to comment Share on other sites More sharing options...
Paulie Posted September 3, 2006 Share Posted September 3, 2006 As Azu suggested, this would probably be the easiest way to get a near accurate Clicks per second While 1 $Clicks=*Your Number Here* Mouseclick("Left",x,y, $Clicks,0);How many times to click $Dur = 1000-$Clicks Sleep($Dur) Wend Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted September 3, 2006 Share Posted September 3, 2006 ummm sleeping a second and then clicking wont give the amount of clicks per second, itll sleep for a second than click idk how that helps, what so ever and looking at your code you wont even get one click in the first place Link to comment Share on other sites More sharing options...
Azu Posted September 3, 2006 Share Posted September 3, 2006 (edited) Or you could try $clicks=;Number of clicks here while 1 $timer=timerinit() mouseclick("Left",$x,$y, $clicks,0) $timer=(timerdiff($timer))/1000 $timer=$clicks/$timer wend Now $timer should equal how many clicks per second you are getting Edited September 3, 2006 by Azu Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 3, 2006 Moderators Share Posted September 3, 2006 Or you could try $clicks=;Number of clicks here while 1 $timer=timerinit() mouseclick("Left",$x,$y, $clicks,0) $timer=(timerdiff($timer))/1000 $timer=$clicks/$timer wend Now $timer should equal how many clicks per second you are getting Might want to re-check your logic there Azu... This gives a fairly accurate clicks per second... about 43 per second on mine with no sleep and 30 with Sleep(10). HotKeySet('{ESC}', '_ExitNow') Local $xCoord = 500, $yCoord = 500, $iCount Local $iTimer = TimerInit() While 1 $iCount += 1 MouseClick('Left', $xCoord, $yCoord, 1, 1) ToolTip('Average Clicks Per Second = ' & Int($iCount / (TimerDiff($iTimer) / 1000)), 0, 0) ;Sleep(10) WEnd Func _ExitNow() Exit EndFunc Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Azu Posted September 3, 2006 Share Posted September 3, 2006 I'm not sure what's wrong with the logic in it. And it seems to use a little less CPU in the task manager. If won't work if you just copy and paste it though, you have to set the vars to something.. Like this; HotKeySet('{esc}', 'ex') $clicks=1 $x=500 $y=500 while 1 $timer=timerinit() mouseclick("Left",$x,$y,$clicks,0) $timer=(timerdiff($timer))/1000 $timer=$clicks/$timer tooltip("Clicks per second="&$timer) wend func ex() exit endfunc Your's is cool to though. =D Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 3, 2006 Moderators Share Posted September 3, 2006 I was aware of the $x/$y needing coords I only looked over yours and it didn't look right for some reason... I see it will also work now that I see you're re-setting TimerInit() after $clicks/$timer. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
iZafiro Posted September 5, 2006 Author Share Posted September 5, 2006 (edited) Whoa. Hold it there. @ Paulie As Azu suggested, this would probably be the easiest way to get a near accurate Clicks per second While 1 $Clicks=*Your Number Here* Mouseclick("Left",x,y, $Clicks,0);How many times to click $Dur = 1000-$Clicks Sleep($Dur) Wend The point of this autoclicker is to keep clicking, not click click, pause, click click, and so on. Azu, if you take the time it takes to click (lets say.. hmm ok 200 milliseconds) Then you take it over 1000, (200/1000 = 0.2) then you divide it by 1, you will get 0.2 clicks per second, which is wrong, you should get 5 clicks per second.. I think the math is like Ok the script takes same as above example to run, 200ms, 1000/200 = 5. That should be the clicks per second. Anyway, i've changed my script somewhat (at least the clicking part). here. (anyway, I dont think I want to set the number of clicks anymore. After all, the main purpose of this is to click as fast as possible. Now i just want a good clicks per second calculation and for it to work inside the game.) Offtopic: how do you make your code have automatic AutoIt colouring here? expandcollapse popup#include <GUIConstants.au3> $scriptTitle = "AC" If Winexists($scriptTitle) Then Exit AutoItWinSetTitle($scriptTitle) MsgBox(0,"Notification","Version 1.1. F1 to start, F2 to stop, Esc to exit. Or, you can simply click the buttons. Hee hee.") HotKeySet("{F1}","Start") HotKeySet("{F2}","Stop") HotKeySet("{ESC}","Terminate") Opt("GUIOnEventMode", 1) Opt("MouseClickDelay",0) ;This was why mouseclick() was slower than mousedown() before. Opt("MouseClickDownDelay",0) Opt("SendKeyDelay", 0);This was why send() slowed the whole autoclicking down. Opt("SendKeyDownDelay", 0) $ACwindow = GUICreate("Auto Clicker", 200, 130) GUISetOnEvent($GUI_EVENT_CLOSE, "Terminate") $clickspeed = GUICtrlCreateInput("0",110,12,50,20,$ES_READONLY) GUICtrlCreateLabel("Click speed", 30, 15) GUICtrlCreateLabel("F1 to start, F2 to stop and Esc to quit.", 15, 65) $autoenter = GUICtrlCreateCheckbox("Auto-enter", 65,37) $startClicking = GUICtrlCreateButton("Start", 20, 90, 70) GUICtrlSetOnEvent($startClicking,"Start") $stopClicking = GUICtrlCreateButton("Stop", 115, 90, 70) GUICtrlSetOnEvent($stopClicking,"Stop") GUISwitch($ACwindow) GUISetState(@SW_SHOW) $x = 1 While 1 ;$a = TimerInit();I wonder if i put it here... If $x = 2 Then If GUICtrlRead($autoenter) = 1 Then For $i = 1 to 5 Step +1 MouseClick("left",MouseGetPos(0),MouseGetPos(1),1) Send("{ENTER}") ;GUICtrlSetData($clickspeed,( 1000/ (TimerDiff($a)+7) ) *5) ;This weird thing (+lag and times number of times)... just an experiment. Please try on your comp and see if it does it counts correctly. Next Else MouseClick("left",MouseGetPos(0),MouseGetPos(1),500) ;GUICtrlSetData($clickspeed,1000/TimerDiff($a)* 500) eek, it's still giving me freak numbers. EndIf EndIf WEnd Func Start() If $x = 1 Then $x += 1 EndIf EndFunc Func Stop() If $x = 2 Then $x -= 1 MouseUp("left") EndIf EndFunc Func Terminate() Exit EndFunc I'm desperate now, giving you my whole code... I just cant think of how to properly moniter the clicks per second and how to use the functions mentioned below... Still, if i put the timer thing, it always gives me a crazy amount. Anyway, at least it still clicks fast (3000+ per second) without autoenter, and even when autoenter is on, it clicks 600-700 times a second. BUT, it still doesn't work in maple. I guess I will have to figure out the ControlClick() and ControlSend() functions. As the game is fullscreen and always on top, I have no way to find out the control id and title Wait a second there. Is the title just the name of the window like for example notepad would be "Untitled - Notepad" ? or do I put the class name there? e.g. Notepad will be "classname=Notepad" And, as for the control ID thing, what if i just want it to click wherever my mouse is ON the program? ... really confused here... Edited September 5, 2006 by iZafiro Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now