holzrusse Posted July 6, 2020 Share Posted July 6, 2020 Hey, I'm trying to create a script which will Move my Cursor to the color location found via PixelSearch: 0xFB9303 After that it should wait until the color changes to 0xFFCFC7 As soon as it changes to 0xFFCFC7 it should click on it as fast as possible I tryed a few things but could not figure out how to do that and get it working. Thats my Code so far which is as it is right now only clicking on the Color it should click on, but sadly thats too slow: HotKeySet("g", "start") HotKeySet("h", "stop") While 1 Sleep(100) WEnd func stop() Exit EndFunc func start() while 1 $productbar1 = PixelSearch(850,750,1050,800, 0xFFCFC7,0) If Not @error Then MouseMove($productbar1[0],$productbar1[1], 1) MouseClick("left", $productbar1[0], $productbar1[1]-5, 1, 0) EndIf Sleep(200) WEnd EndFunc thank you in advance and i hope i explained it well, sorry for my bad english. Link to comment Share on other sites More sharing options...
Musashi Posted July 6, 2020 Share Posted July 6, 2020 This question, with slight variations, has been asked thousands of times. The default answer is : "Which application or website do you want to automate. There are almost always more reliable methods available than Pixelsearch." More details and also screenshots would be helpful for further assistance. "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...
holzrusse Posted July 6, 2020 Author Share Posted July 6, 2020 Well, i changed the code a bit: #RequireAdmin HotKeySet("g", "start") HotKeySet("h", "stop") $WaitColor=0xFB9303 $ClickColor=0xFFCFC7 While 1 Sleep(100) WEnd func stop() Exit EndFunc func start() while 1 $productbar1 = PixelSearch(850,750,1050,800, $WaitColor,0) If Not @error Then MouseMove($productbar1[0],$productbar1[1], 1) EndIf $productbar2 = PixelSearch(850,750,1050,800, $ClickColor,0) If Not @error Then MouseMove($productbar1[0],$productbar1[1], 0) MouseClick("left", $productbar1[0], $productbar1[1]-5, 1, 0) Sleep(200) EndIf WEnd EndFunc and now it is working like it should but it crashes after a few seconds with the Crash Code Line 20 (File:"File Path, File Name") Error: Subscript used on non-accessible variable But Anyways, here are the informations you asked for: there is this little Bar with the blue thing going to the left and to the right side, As soon as it hits the Yellow Thing, the color changes: Now what i want to do is to let the script move to the Yellow thing of the Screenshot above, as soon as it appears on the screen, but wait, and as soon as the color changes to the one of the screenshot below it should click on it. Its not really an automation its more like workflow optimization in my opinion. Hope you understand what i'm talking about and can help me Thanks. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted July 6, 2020 Moderators Share Posted July 6, 2020 @holzrusse That looks an awful lot like you're trying to automate a game, am I correct? ====In case you missed it, this is a Mod stepping into a thread==== "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
holzrusse Posted July 6, 2020 Author Share Posted July 6, 2020 Just now, JLogan3o13 said: @holzrusse That looks an awful lot like you're trying to automate a game, am I correct? As i said, i'm not looking for to automate a game, just a completion to make it a bit easier, but still nothing where you can go afk or something "gamebreaking" ====In case you missed it, this is a Mod stepping into a thread==== JLogan3o13 1 Link to comment Share on other sites More sharing options...
Developers Jos Posted July 6, 2020 Developers Share Posted July 6, 2020 7 minutes ago, holzrusse said: As i said, i'm not looking for to automate a game, just a completion to make it a bit easier, but still nothing where you can go afk or something "gamebreaking" So the answer is : Yes it is for a Game! right? Jos 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...
holzrusse Posted July 6, 2020 Author Share Posted July 6, 2020 Just now, Jos said: So the answer is : Yes it is for a Game! right? Jos Yes Link to comment Share on other sites More sharing options...
Developers Jos Posted July 6, 2020 Developers Share Posted July 6, 2020 (edited) Then things are simple: Welcome to the AutoIt forum. Unfortunately you appear to have missed the Forum rules on your way in. Please read them now - particularly the bit about not discussing game automation - and then you will understand why you will get no help and this thread will now be locked. See you soon with a legitimate question I hope. The Moderation team Edited July 6, 2020 by Jos 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