rbnice1 Posted March 21, 2009 Share Posted March 21, 2009 So I need to basically check 23 pixels colors. I have been trying to use "PixelGetColor". It works about 80% but sometimes it will display the wrong color then the next time its fine again. Here is a example: CODE Global $Going Global $x Global $y Global $z Global $firstperson Global $toggle Global $tempcolor1 Global $tempcolor2 Global $tempcolor3 Global $tempcolor4 Global $tempcolor5 Global $tempcolor6 Global $tempcolor7 Global $tempcolor8 Global $tempcolor9 Global $spellslotcolor1 Global $spellslotcolor2 Global $spellslotcolor3 Global $spellslotcolor4 Global $spellslotcolor5 Global $spellslotcolor6 Global $spellslotcolor7 Global $spellslotcolor8 Global $spellslotcolor9 Global $spellslotcolor10 Global $spellslotcolor11 Global $spellslotcolor12 Global $spellslotcolor13 Global $spellslotcolor14 Global $tempcolor Global $Turning HotKeySet("^!s", "StartScript2") While 1 Sleep(100) WEnd Func StartScript2() Sleep(1400) $Timer = $Timer + 1400 $tempcolor1 = PixelGetColor(394,113) Sleep(20) $Timer = $Timer + 20 $tempcolor2 = PixelGetColor(411,113) Sleep(20) $Timer = $Timer + 20 $tempcolor3 = PixelGetColor(428,113) Sleep(20) $Timer = $Timer + 20 $tempcolor4 = PixelGetColor(445,113) Sleep(20) $Timer = $Timer + 20 $tempcolor5 = PixelGetColor(462,113) Sleep(20) $Timer = $Timer + 20 $tempcolor6 = PixelGetColor(479,113) Sleep(20) $Timer = $Timer + 20 $tempcolor7 = PixelGetColor(496,113) Sleep(20) $Timer = $Timer + 20 $tempcolor8 = PixelGetColor(513,113) Sleep(20) $Timer = $Timer + 20 $tempcolor9 = PixelGetColor(382,45) Sleep(20) $Timer = $Timer + 20 $spellslotcolor1 = PixelGetColor(1144,29) Sleep(20) $Timer = $Timer + 20 $spellslotcolor2 = PixelGetColor(1144,53) Sleep(20) $Timer = $Timer + 20 $spellslotcolor3 = PixelGetColor(1144,77) Sleep(20) $Timer = $Timer + 20 $spellslotcolor4 = PixelGetColor(1144,101) Sleep(20) $Timer = $Timer + 20 $spellslotcolor5 = PixelGetColor(1144,125) Sleep(20) $Timer = $Timer + 20 $spellslotcolor6 = PixelGetColor(1144,149) Sleep(20) $Timer = $Timer + 20 $spellslotcolor7 = PixelGetColor(1144,173) Sleep(20) $Timer = $Timer + 20 $spellslotcolor8 = PixelGetColor(1244,29) Sleep(20) $Timer = $Timer + 20 $spellslotcolor9 = PixelGetColor(1244,53) Sleep(20) $Timer = $Timer + 20 $spellslotcolor10 = PixelGetColor(1244,77) Sleep(20) $Timer = $Timer + 20 $spellslotcolor11 = PixelGetColor(1244,101) Sleep(20) $Timer = $Timer + 20 $spellslotcolor12 = PixelGetColor(1244,125) Sleep(20) $Timer = $Timer + 20 $spellslotcolor13 = PixelGetColor(1244,149) Sleep(20) $Timer = $Timer + 20 $spellslotcolor14 = PixelGetColor(1244,173) Sleep(20) $Timer = $Timer + 20 $tempcolor = PixelGetColor(396,46) ;Send("{ENTER}") ;Sleep(500) ;Send ("/g " + $tempcolor1) ;Send("{ENTER}") ;Sleep(500) ;Send("{ENTER}") ;Sleep(500) ;Send ("/g " + $tempcolor2) ;Send("{ENTER}") ;Sleep(500) ;Send("{ENTER}") ;Sleep(500) ;Send ("/g " + $tempcolor3) ;Send("{ENTER}") ;Sleep(500) ;Send("{ENTER}") ;Sleep(500) ;Send ("/g " + $tempcolor4) ;Send("{ENTER}") ;Sleep(500) ;Send("{ENTER}") ;Sleep(500) ;Send ("/g " + $tempcolor5) ;Send("{ENTER}") ;Sleep(500) ;Send("{ENTER}") ;Sleep(500) ;Send ("/g " + $tempcolor6) ;Send("{ENTER}") Sleep(500) Send("{ENTER}") Sleep(500) Send("/g ") Send($spellslotcolor1) Send(" ") Send($spellslotcolor2) Send(" ") Send($spellslotcolor3) Send(" ") Send($spellslotcolor4) Send(" ") Send($spellslotcolor5) Send(" ") Send($spellslotcolor6) Send(" ") Send("{ENTER}") EndFunc So I am tring to find a way to do this with it working correctly all the time. So I found a example to basically do a screenshot then you do your pixel checks against it. From what I have read its faster and more reliable. So here is that I have so far but it doesnt work. I am not sure how to make this function correctly: CODE ;New Pixel check start #include <_PixelGetColor.au3> #include <Misc.au3> Send("`") Sleep(500) $hDll = DllOpen("gdi32.dll") $vDC = _PixelGetColor_CreateDC($hDll) $vRegion = _PixelGetColor_CaptureRegion($vDC, 0,0,@DesktopWidth,@DesktopHeight,$hDll) ; click left mouse button to exit $tempcolor1 = _PixelGetColor_GetPixel($vDC, 394,113, $hDll) Sleep(10) $tempcolor2 = _PixelGetColor_GetPixel($vDC, 411,113, $hDll) Sleep(10) $tempcolor3 = _PixelGetColor_GetPixel($vDC, 428,113, $hDll) Sleep(10) $tempcolor4 = _PixelGetColor_GetPixel($vDC, 445,113, $hDll) Sleep(10) $tempcolor5 = _PixelGetColor_GetPixel($vDC, 462,113, $hDll) Sleep(10) $tempcolor6 = _PixelGetColor_GetPixel($vDC, 479,113, $hDll) Sleep(10) $tempcolor7 = _PixelGetColor_GetPixel($vDC, 496,113, $hDll) Sleep(10) $tempcolor8 = _PixelGetColor_GetPixel($vDC, 513,113, $hDll) Sleep(10) $tempcolor9 = _PixelGetColor_GetPixel($vDC, 382,45, $hDll) Sleep(10) $spellslotcolor1 = _PixelGetColor_GetPixel($vDC, 1144,29, $hDll) Sleep(10) $spellslotcolor2 = _PixelGetColor_GetPixel($vDC, 1144,53, $hDll) Sleep(10) $spellslotcolor3 = _PixelGetColor_GetPixel($vDC, 1144,77, $hDll) Sleep(10) $spellslotcolor4 = _PixelGetColor_GetPixel($vDC, 1144,101, $hDll) Sleep(10) $spellslotcolor5 = _PixelGetColor_GetPixel($vDC, 1144,125, $hDll) Sleep(10) $spellslotcolor6 = _PixelGetColor_GetPixel($vDC, 1144,149, $hDll) Sleep(10) $spellslotcolor7 = _PixelGetColor_GetPixel($vDC, 1144,173, $hDll) Sleep(10) $spellslotcolor8 = _PixelGetColor_GetPixel($vDC, 1244,29, $hDll) Sleep(10) $spellslotcolor9 = _PixelGetColor_GetPixel($vDC, 1244,53, $hDll) Sleep(10) $spellslotcolor10 = _PixelGetColor_GetPixel($vDC, 1244,77, $hDll) Sleep(10) $spellslotcolor11 = _PixelGetColor_GetPixel($vDC, 1244,101, $hDll) Sleep(10) $spellslotcolor12 = _PixelGetColor_GetPixel($vDC, 1244,125, $hDll) Sleep(10) $spellslotcolor13 = _PixelGetColor_GetPixel($vDC, 1244,149, $hDll) Sleep(10) $spellslotcolor14 = _PixelGetColor_GetPixel($vDC, 1244,173, $hDll) _PixelGetColor_ReleaseRegion($vRegion) _PixelGetColor_ReleaseDC($vDC,$hDll) DllClose($hDll) I have never used the "#include function". I just need a reliable way to check pixel colors. Link to comment Share on other sites More sharing options...
TerarinK Posted March 22, 2009 Share Posted March 22, 2009 Is this for a fast changing game or some movie-type of performance? Also do find the size of the thing your going to be finding, every bit speeds up your capturing. As long as you have _PixelGetColor.au3 in the include folder or where the au3 file is stored. Are you doing something else beside just capturing the color of the screen? If so then you should try to PixelGetColor and all 23 of them then you got them in a variable then do your calculation. That can enable the thing to continue on without a moment of capturing, the PixelGetColor roughly averages between 1 to 5 mmsec so the most I will deal with is 100 mmsec which I can live with. 0x576520616C6C206469652C206C697665206C69666520617320696620796F75207765726520696E20746865206C617374207365636F6E642E 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