Sakkz Posted June 9, 2022 Share Posted June 9, 2022 (edited) I'm trying to make it click only once but it just keeps clicking, I'm new and I used examples to come up with this code but idk what is wrong $left = 353 $bottom = 972 $right = 513 $top = 855 $color = 0xDD2E44 Global $Paused, $Runner HotKeySet("{f7}", "TogglePause") HotKeySet("{f8}", "Terminate") Func TogglePause() $Paused = Not $Paused While $Paused Sleep(10) ToolTip('Script is "Paused"', 0, 0) WEnd ToolTip("") EndFunc Func Terminate() Exit 0 EndFunc Sleep(2500) while(true) $pix = PixelSearch($right, $bottom, $left, $top, $color) if Not @error Then MouseClick("left", $pix[0], $pix[1], 1, 0) EndIf WEnd Edited June 9, 2022 by Jos added codebox Link to comment Share on other sites More sharing options...
Developers Jos Posted June 9, 2022 Developers Share Posted June 9, 2022 43 minutes ago, Sakkz said: it click only once but it just keeps clicking, Right .. don't you think this has something to do with the While...Wend loop you have put in your script? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Musashi Posted June 9, 2022 Share Posted June 9, 2022 41 minutes ago, Sakkz said: I'm trying to make it click only once but it just keeps clicking Then you should not run PixelSearch in a loop. Furthermore, the order of the parameters when calling Pixelsearch is wrong (take a look at the help). "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Link to comment Share on other sites More sharing options...
Nine Posted June 9, 2022 Share Posted June 9, 2022 @Musashi The order provided within PixelSearch can be mixed : Quote The search direction varies as follows: Left-to-Right - left < right Right-to-Left - right < left Top-to-Bottom - top < bottom Bottom-to-Top - bottom < top “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Musashi Posted June 9, 2022 Share Posted June 9, 2022 2 hours ago, Nine said: The order provided within PixelSearch can be mixed : I am aware of that, but you are right - "wrong order of parameters" is not a correct statement. . According to the help, Param1 is the left coordinate and Param3 the right one. The search direction can be reversed, if one sets the value of Param1(left) greater than the value of Param3(right). (Analog for Param2(top) and Param4(bottom)). I just wanted to make sure, @Sakkz got this point right. In the end, it's probably just a matter of personal preference whether you set : $left = 353, $bottom = 972, $right = 513, $top = 855, $color = 0xDD2E44 $pix = PixelSearch($right, $bottom, $left, $top, $color) or : $left = 513, $top = 972, $right = 353, $bottom = 855, $color = 0xDD2E44 $pix = PixelSearch($left, $top, $right, $bottom, $color) which fits at least better to the help, regarding the naming of the variables. "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Link to comment Share on other sites More sharing options...
Sakkz Posted June 10, 2022 Author Share Posted June 10, 2022 To explain what exactly I'm trying to do. In a discord group I'm in, the owner does these random giveaways which you have to react within like 5 seconds. (The winner gets their idea used for the owner to use as a rp character) and so I just want it to loop PixelSearch till it finds it and only clicks it once instead of it acting like an autoclicker. But if this sorta thing isn't allowed then I apologize Link to comment Share on other sites More sharing options...
Developers Jos Posted June 10, 2022 Developers Share Posted June 10, 2022 2 minutes ago, Sakkz said: But if this sorta thing isn't allowed then I apologize That is something you can determine yourself by taking the time to read or forum rules ! SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. 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