DarkKai Posted February 10, 2006 Posted February 10, 2006 hi, i was wondering if this could be sped up anymore? it dont send the keys fast enuff like, if it sends 1 key and then like not even 1/3rd of a sec later it has to send another it dont.. expandcollapse popupLocal $Coords7 Local $Coords5 Local $Coords3 Local $Coords4 Local $Coords6 Local $Coords1 Local $Coords2 HotKeySet("{Esc}", "MyExit") While 1 sleep(1) $Coords7 = PixelSearch( 166, 472, 188, 478, 15725559) If @Error Then Else Send("{l}") endif $Coords5 = PixelSearch( 115, 472, 136, 478, 15725559) If @Error Then Else Send("{j}") endif $Coords3 = PixelSearch( 56, 472, 80, 478, 15725559) If @Error Then Else Send("{f}") endif $Coords4 = PixelSearch( 84, 472, 112, 478, 16763730) If @Error Then Else Send("{space}") endif $Coords1 = PixelSearch( 33, 472, 53, 480, 4380671) If @Error Then Else Send("{d}") EndIf $Coords2 = PixelSearch( 7, 472, 26, 478, 15725559, 3) If @Error Then Else Send("{s}") endif $Coords6 = PixelSearch( 144, 472, 161, 478, 4380671) If @Error Then Else Send("{k}") endif WEnd Func MyExit() Exit EndFunc um..its my first one so...be kind
Valuater Posted February 10, 2006 Posted February 10, 2006 (edited) change them to this$Coords7 = PixelSearch( 166, 472, 188, 478, 15725559) If Not @Error Then Send("{l}"8)BTWWelcome to Autoityou should have a look at thishttp://www.autoitscript.com/forum/index.php?showtopic=21048# Edited February 10, 2006 by Valuater
DarkKai Posted February 10, 2006 Author Posted February 10, 2006 (edited) change them to this $Coords7 = PixelSearch( 166, 472, 188, 478, 15725559) If Not @Error Then Send("{l}" 8) BTW Welcome to Autoit you should have a look at this http://www.autoitscript.com/forum/index.php?showtopic=21048# i think PixelSearch is to slow for what i need to do... umm is there a way to make it press a key when the color of 1 pixel has changed? sounds like PixelSearch...lol if not is there another way to speed it up? btw thx for that tip, it was alot faster but still not fasteuff.... still misses some keys Edited February 10, 2006 by DarkKai
Valuater Posted February 10, 2006 Posted February 10, 2006 here is a script to help find a color, and if the color changes it will notify youhttp://www.autoitscript.com/forum/index.php?showtopic=16789#8)
DarkKai Posted February 10, 2006 Author Posted February 10, 2006 here is a script to help find a color, and if the color changes it will notify youhttp://www.autoitscript.com/forum/index.php?showtopic=16789#8)the thing is i know the colors in advanced, i was wondering if there was a cmd for it to hit a key if the color changed...fast... i have 7 spots it has to look at...but only 3 colors... say if the pixel is black and it changed to anything other than black it would hit a key
Valuater Posted February 10, 2006 Posted February 10, 2006 it was in there While $check $var2 = PixelGetColor( $pos[0] , $pos[1]) If $my_color <> $var2 Then MsgBox(262208, "Color Check", " the Color has changed ") ExitLoop EndIf WEnd 8)
DarkKai Posted February 10, 2006 Author Posted February 10, 2006 (edited) it was in there While $check $var2 = PixelGetColor( $pos[0] , $pos[1]) If $my_color <> $var2 Then MsgBox(262208, "Color Check", " the Color has changed ") ExitLoop EndIf WEnd 8) i dont get alot of that lol HotKeySet("{Esc}", "MyExit") While 1 Sleep(1) $Coords7 = PixelSearch( 166, 460, 188, 471, 15725559) If not @Error Then Send("{l}") $Coords5 = PixelSearch( 115, 460, 136, 471, 15725559) If not @Error Then Send("{j}") $Coords3 = PixelSearch( 56, 460, 80, 471, 15725559) If not @Error Then Send("{f}") $Coords4 = PixelSearch( 84, 460, 112, 471, 16763730) If not @Error Then Send("{space}") $Coords1 = PixelSearch( 33, 460, 53, 471, 4380671) If not @Error Then Send("{d}") $Coords2 = PixelSearch( 7, 460, 26, 471, 15725559, 3) If not @Error Then Send("{s}") $Coords6 = PixelSearch( 144, 460, 161, 471, 4380671) If not @Error Then Send("{k}") WEnd Func MyExit() Exit EndFunc thats what i have now... like i said its faster but still too slow for what i need... if u can explain While $check $var2 = PixelGetColor( $pos[0] , $pos[1]) If $my_color <> $var2 Then MsgBox(262208, "Color Check", " the Color has changed ") ExitLoop EndIf WEnd a little bit more it hits alot of the keys but if it has to hit like the first 1 on my script and my last 1 on there it will miss...or if it has to hit the first then 2nd then first again it will miss.... Edited February 10, 2006 by DarkKai
andyswarbs Posted February 10, 2006 Posted February 10, 2006 What might help is to undestand your goals. What is your program actually trying to do? What is the pseudocode? Without such input we can provide ideas limited by our (possibly mis-)interpretation of where you are going. Licensing.au3Extended _Max & _Min_MsgBoxExitVarious extensions to _GuiCtrl...Run Dos programs output into an array etc (Updated 19-Feb-06)Extensions to Array library, primarily in two dimensions (updated 20-Feb-06)Version dependency calculator, _IsVer1GEVer2User Management, answering some domain questions (updated 19-Feb-06, various bugfixes and new functions added)Extensions to registry manipulation, including a recursive search & replaceDelimited string library (updated 19-Feb-03, added _DelimListSort)String library extensionsTerminal Server supportFile libraryCommand line parser (added 18-Feb-06)(UDF homepage) (Scit4Au3 UserCallTips added 21-Feb-06)
Moderators SmOke_N Posted February 10, 2006 Moderators Posted February 10, 2006 (edited) What might help is to undestand your goals. What is your program actually trying to do? What is the pseudocode? Without such input we can provide ideas limited by our (possibly mis-)interpretation of where you are going.I'll agree with this, between Val and him, this has gone onto a different area, and I'm confused on what the specific options your looking for are. To speed up a search, you could use the step that I'll show in my example, it will be twice as fast on the scan. I would also suggest to use the Hex '0x' numbers rather than the decimals. I also aligned them (maybe you wanted them in a specific order so you could change them) to search in order from least to greatest. Opt('PixelCoordMode', 0); check to make sure you don't need to change the 0 to 1 or 2 in the help file Opt('SendKeyDelay', 0) HotKeySet("{Esc}", "MyExit") While 1 Sleep(10) If PixelSearch(7, 472, 26, 478, 15725559, 3, 2) <> 1 Then Send("{s}") If PixelSearch(33, 472, 53, 480, 4380671, 0, 2) <> 1 Then Send("{d}") If PixelSearch(56, 472, 80, 478, 15725559, 0, 2) <> 1 Then Send("{f}") If PixelSearch(84, 472, 112, 478, 16763730, 0, 2) <> 1 Then Send("{space}") If PixelSearch(115, 472, 136, 478, 15725559, 0, 2) <> 1 Then Send("{j}") If PixelSearch(144, 472, 161, 478, 4380671, 0, 2) <> 1 Then Send("{k}") If PixelSearch(166, 472, 188, 478, 15725559, 0, 2) <> 1 Then Send("{l}") WEnd Func MyExit() Exit EndFunc Edit: Or you could do it like this: Opt('PixelCoordMode', 0); check to make sure you don't need to change the 0 to 1 or 2 in the help file Opt('SendKeyDelay', 0) HotKeySet("{Esc}", "MyExit") While 1 Sleep(10) If IsArray(PixelSearch(906, 563, 906, 563, 0xFFFFFF, 3, 2)) Then Send("{s}") If IsArray(PixelSearch(33, 472, 53, 480, 4380671, 0, 2)) Then Send("{d}") If IsArray(PixelSearch(56, 472, 80, 478, 15725559, 0, 2)) Then Send("{f}") If IsArray(PixelSearch(84, 472, 112, 478, 16763730, 0, 2)) Then Send("{space}") If IsArray(PixelSearch(115, 472, 136, 478, 15725559, 0, 2)) Then Send("{j}") If IsArray(PixelSearch(144, 472, 161, 478, 4380671, 0, 2)) Then Send("{k}") If IsArray(PixelSearch(166, 472, 188, 478, 15725559, 0, 2)) Then Send("{l}") WEnd Func MyExit() Exit EndFunc Edited February 10, 2006 by SmOke_N 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.
DarkKai Posted February 10, 2006 Author Posted February 10, 2006 What might help is to undestand your goals. What is your program actually trying to do? What is the pseudocode? Without such input we can provide ideas limited by our (possibly mis-)interpretation of where you are going.my program is tryin to hit a key when it finds a color in the area i say, its all random and it happens fastlike, area | | and if said area turns to black than hit a key, 7 areas, and if 2 of thos areas change at once or fast in succession than it hits the key too late
Valuater Posted February 10, 2006 Posted February 10, 2006 (edited) press a key when the color of 1 pixel has changed?maybe you could change the above code toIf PixelGetColor(7, 472) <> $yourColor Then Send("{s}")that was the direction SmOke8) Edited February 10, 2006 by Valuater
Moderators SmOke_N Posted February 11, 2006 Moderators Posted February 11, 2006 maybe you could change the above code toIf PixelGetColor(7, 472) <> $yourColor Then Send("{s}")that was the direction SmOke8)Well, it sounds like the direction I would take Val, but.. he seems to want to check an area, and if it is <> then the color he wanted then, the code given would be wrong (that I gave). Would have to put Not in front of the PixelSearch() on the first example, and Not in front of IsArray on the 2nd example. 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.
DarkKai Posted February 11, 2006 Author Posted February 11, 2006 maybe you could change the above code toIf PixelGetColor(7, 472) <> $yourColor Then Send("{s}")that was the direction SmOke8)well the color of the spot i need it to check switches colors... every few sec, 0xde3431 and 0xb52429 can i make it check for thos 2 at that spot and then hit if not thos 2?
Valuater Posted February 11, 2006 Posted February 11, 2006 like If PixelGetColor(7, 472) <> $yourColor Or PixelGetColor(7, 472) <> $your2ndColor Then Send("{s}") 8)
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