bigassmuffin Posted June 10, 2006 Posted June 10, 2006 How can I make a continues loop troughout whole script where it keeps pressing the left mouse button every 5 seconds wherever the cursor may be I know there is : MouseClick('left', $coord[0], $coord[1] - 0, 1, 0) but how can I get this to keep looping?
Nomad Posted June 10, 2006 Posted June 10, 2006 How can I make a continues loop troughout whole script where it keeps pressing the left mouse button every 5 seconds wherever the cursor may be I know there is : MouseClick('left', $coord[0], $coord[1] - 0, 1, 0) but how can I get this to keep looping? While(1) MouseClick('left', $coord[0], $coord[1] - 0, 1, 0) Sleep(5000) WEnd Nomad
bigassmuffin Posted June 10, 2006 Author Posted June 10, 2006 While(1) MouseClick('left', $coord[0], $coord[1] - 0, 1, 0) Sleep(5000) WEnd Nomad I already have a While1, should I change to While2? lol
Nomad Posted June 10, 2006 Posted June 10, 2006 (edited) or, since I misunderstood the question, start a timer and make it go to a function every 5 seconds like: $begin = TimerInit() ; ;script stuff ; $dif = TimerDiff($begin) If $dif > 5000 Then MouseClick() ; ;more script stuff ; Func MouseClick() MouseClick('left', $coord[0], $coord[1] - 0, 1, 0) EndFunc Experiment around. The way this is implemented depends on your script. You may also need additional timers or a way to bypass this existing timer if the script is going to loop around in less than 5 seconds, or it will restart the timer and never go to the function. Edit: you also can't use MouseClick as a function name, it was just an example. Edited June 10, 2006 by Nomad
Nomad Posted June 10, 2006 Posted June 10, 2006 I already have a While1, should I change to While2? lol It doesn't matter. The 1 is just a statement that is always true and that's why it makes the While continue to loop. You can use any number you want, but it doesn't change anything if you use the same number over and over.
Moderators SmOke_N Posted June 10, 2006 Moderators Posted June 10, 2006 This is a classic case of, "Can I" , "I have", "No I won't Show... But answer my question anyway". 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.
Nomad Posted June 10, 2006 Posted June 10, 2006 This is a classic case of, "Can I" , "I have", "No I won't Show... But answer my question anyway". It's also a regular case in this forum.
Daniel W. Posted June 10, 2006 Posted June 10, 2006 Is it possible to define a function in a script that is defined by autoit? in nomads script he defines MouseClick() but then he calls Mouseclick(left,...) in the function. I think it wont work or? --------------------------------------------------------------------------------------------------------------------------------Scripts : _Encrypt UDF_UniquePCCode UDF MS like calculatorInstall programm *UPDATED* --------------------------------------------------------------------------------------------------------------------------------[quote name='Helge' post='213117' date='Jul 26 2006, 10:22 AM']Have you ever tried surfing the internet with a milk-carton ?This is similar to what you're trying to do.[/quote]
bigassmuffin Posted June 10, 2006 Author Posted June 10, 2006 (edited) wat im trying to go for is combining two scripts to keep playing and looping together..whcih are these two scripts: Opt("WinTitleMatchMode",2) WinWaitActive("[Conquer2.0]") $color = 0xB50400 $color2 = 0xFFD76B $game = 0 HotKeySet("+q", "Play") HotKeySet("{ESC}", "quit") While 1 If $game = 1 Then $coord = PixelSearch( 0, 0, 1023, 651, $color, 10, 20) If IsArray($coord) = 1 Then MouseClick('left', $coord[0], $coord[1] - -30, 1, 0) Sleep(3000) EndIf EndIf WEnd Func Play() If $game < 1 Then $game = $game + 1 Else $game = 0 EndIf EndFunc Func quit() Exit EndFunc AND While 1 If $game = 1 Then $coord = PixelSearch( 0, 0, 1023, 651, $color2, 30, 5) If IsArray($coord) = 1 Then MouseClick('left', $coord[0], $coord[1] - 0, 1, 0) Sleep(3000) EndIf EndIf WEnd Can I jsut do: (nm, that doesnt work?) expandcollapse popupOpt("WinTitleMatchMode",2) WinWaitActive("[Conquer2.0]") $color = 0xB50400 $color2 = 0xFFD76B $game = 0 HotKeySet("+q", "Play") HotKeySet("{ESC}", "quit") While 1 If $game = 1 Then $coord = PixelSearch( 0, 0, 1023, 651, $color, 10, 20) If IsArray($coord) = 1 Then MouseClick('left', $coord[0], $coord[1] - -30, 1, 0) Sleep(3000) EndIf EndIf WEnd While 1 If $game = 1 Then $coord = PixelSearch( 0, 0, 1023, 651, $color2, 30, 5) If IsArray($coord) = 1 Then MouseClick('left', $coord[0], $coord[1] - 0, 1, 0) Sleep(3000) EndIf EndIf WEnd Func Play() If $game < 1 Then $game = $game + 1 Else $game = 0 EndIf EndFunc Func quit() Exit EndFunc ??????? Edited June 10, 2006 by bigassmuffin
Thatsgreat2345 Posted June 10, 2006 Posted June 10, 2006 No autoit doesnt support multithreading, thats like saying im going to go run around the track while i sit down and take a crap on the toilet
bigassmuffin Posted June 10, 2006 Author Posted June 10, 2006 No autoit doesnt support multithreading, thats like saying im going to go run around the track while i sit down and take a crap on the toiletlol, thanks for the help, but is there any way then for it to jsut first read for the first color, then read if theres second color, and keep doing that as a loop?
Paulie Posted June 10, 2006 Posted June 10, 2006 (edited) lol, thanks for the help, but is there any way then for it to jsut first read for the first color, then read if theres second color, and keep doing that as a loop? I believe you should just be able to include both while loops together into 1 Heres a code Opt("WinTitleMatchMode",2) WinWaitActive("[Conquer2.0]") $color = 0xB50400 $color2 = 0xFFD76B $game = 0 HotKeySet("+q", "Play") HotKeySet("{ESC}", "quit") While 1 If $game = 1 then $coord = PixelSearch( 0, 0, 1023, 651, $color, 10, 20) If IsArray($coord) = 1 Then MouseClick('left', $coord[0], $coord[1] - -30, 1, 0) Sleep(3000) EndIf $coord1 = PixelSearch( 0, 0, 1023, 651, $color2, 30, 5) If IsArray($coord1) = 1 Then MouseClick('left', $coord1[0], $coord1[1] - 0, 1, 0) Sleep(3000) EndIf Endif WEnd Func Play() If $game < 1 Then $game = $game + 1 Else $game = 0 EndIf EndFunc Func quit() Exit EndFunc That should work and search for 2 colors Edit:Code Typo Edited June 10, 2006 by Paulie
bigassmuffin Posted June 10, 2006 Author Posted June 10, 2006 (edited) I believe you should just be able to include both while loops together into 1 Heres a code Opt("WinTitleMatchMode",2) WinWaitActive("[Conquer2.0]") $color = 0xB50400 $color2 = 0xFFD76B $game = 0 HotKeySet("+q", "Play") HotKeySet("{ESC}", "quit") While $game = 1 $coord = PixelSearch( 0, 0, 1023, 651, $color, 10, 20) If IsArray($coord) = 1 Then MouseClick('left', $coord[0], $coord[1] - -30, 1, 0) Sleep(3000) EndIf $coord1 = PixelSearch( 0, 0, 1023, 651, $color2, 30, 5) If IsArray($coord1) = 1 Then MouseClick('left', $coord1[0], $coord1[1] - 0, 1, 0) Sleep(3000) EndIf WEnd Func Play() If $game < 1 Then $game = $game + 1 Else $game = 0 EndIf EndFunc Func quit() Exit EndFunc That should work and search for 2 colors Edit:Code Typo Thank you very much for all your time in this script, but unfortunatly it does not work, as soon as I alt tab or click into the game, the script automaticcly cancels (I feel guilty reading your signature paulie in this thread < ) Edited June 10, 2006 by bigassmuffin
Paulie Posted June 10, 2006 Posted June 10, 2006 :"> Thank you very much for all your time in this script, but unfortunatly it does not work, as soon as I alt tab or click into the game, the script automaticcly cancels(I feel guilty reading your signature paulie in this thread < )I edited my post, sorry had a mistake, now it should work :"> as for the sigYou at least tried to do it on your own, not just come here and be likeHeyy au3forums!!!!11!!!!11! WRIT3 ME AN U83r 1337 AIMBOT, PLZZZZ!!!!!!!!!!!!11!!!1!That wht the sig is ment for
bigassmuffin Posted June 10, 2006 Author Posted June 10, 2006 :"> I edited my post, sorry had a mistake, now it should work :"> as for the sigYou at least tried to do it on your own, not just come here and be likeThat wht the sig is ment forWORKS --->PERFECT<---THANK YOU!
Paulie Posted June 10, 2006 Posted June 10, 2006 WORKS --->PERFECT<---THANK YOU!No problem, glad i could help
Nomad Posted June 10, 2006 Posted June 10, 2006 Is it possible to define a function in a script that is defined by autoit? in nomads script he defines MouseClick() but then he calls Mouseclick(left,...) in the function. I think it wont work or? No, you can't use a AutoIt predefined function as a function name. Which is why I edited my post at the bottom saying:Edit: you also can't use MouseClick as a function name, it was just an example.Nomad
jazs Posted June 11, 2006 Posted June 11, 2006 (edited) I am a total noob to all of this.. How would I just make it so that I can get my mouse to double click, lets say every 60 seconds MouseMove(1230, 779, 0) func _mouseclick("left", 0, 500, 2) while 1 sleep(10) wend EndFunc I understand this but I have no idea how to put ths in a loop or even what the code would be. Could you help me Please Edited June 11, 2006 by jazs
Moderators SmOke_N Posted June 11, 2006 Moderators Posted June 11, 2006 While 1 Sleep(60000) MouseClick('Left', 100, 100, 2, 1) WEnd 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.
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