ktvegas Posted March 12, 2005 Share Posted March 12, 2005 Hi, I'm trying to design a small script to monitor an online fighting game (technically, how many players were seated). Basically the function I wrote was supposed to check various pixel locations. If the location was a specific color, then I increment the variable by one. Once all pixel locations are checked, the sum should be the amount returned. The problem..the sum is always 0 - even though I have confirmed that some of the pixel locations did indeed qualify and should have increased the variable by 1. Any help is much appreciated. Thanks Func Sitting() WinActivate($GameWindow); Local $Fighters = 16711680; Occupied seat is color red Local $CountF = 0; start at 0 ;Station 1 If (PixelGetColor(475, 72) = $Fighters) Then $CountF= $CountF+ 1; EndIf ;Station 2 If (PixelGetColor(651, 127) = $Fighters) Then $CountF= $CountF+ 1; EndIf ;Station 3 If (PixelGetColor(693, 221) = $Fighters) Then $CountF= $CountF+ 1; EndIf ; Station 4 If (PixelGetColor(646, 372) = $Fighters) Then $CountF= $CountF+ 1; EndIf ; Station 5 If (PixelGetColor(458, 397) = $Fighters) Then $CountF= $CountF+ 1; EndIf ; Station 6 If (PixelGetColor(316, 397) = $Fighters) Then $CountF= $CountF+ 1; EndIf return $CountF; EndFunc Link to comment Share on other sites More sharing options...
CyberSlug Posted March 12, 2005 Share Posted March 12, 2005 If you are SURE the coordinates are correct and are SURE the value of $Figures is correct, then I don't know the problem. 1) It *Might* help to add WinWaitActive: WinActivate($GameWindow); WinWaitActive($GameWindow) 2) It might help to debug by adding the following line inside each If-Then-EndIf block: FileWriteLine("C:\debug.txt", PixelGetColor(475, 72)) Just open the file with notepad to check the results. Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
quaizywabbit Posted March 12, 2005 Share Posted March 12, 2005 try this and see what happens... Func Sitting() WinActivate($GameWindow); Local $Fighters = 16711680; Occupied seat is color red Local $CountF = 0; start at 0 ;Station 1 If PixelGetColor(475, 72) = $Fighters Then $CountF = $CountF + 1; EndIf ;Station 2 If PixelGetColor(651, 127) = $Fighters Then $CountF = $CountF + 1; EndIf ;Station 3 If PixelGetColor(693, 221) = $Fighters Then $CountF = $CountF + 1; EndIf ; Station 4 If PixelGetColor(646, 372) = $Fighters Then $CountF = $CountF + 1; EndIf ; Station 5 If PixelGetColor(458, 397) = $Fighters Then $CountF = $CountF + 1; EndIf ; Station 6 If PixelGetColor(316, 397) = $Fighters Then $CountF = $CountF + 1; EndIf Return $CountF; EndFunc ;==>Sitting [u]Do more with pre-existing apps![/u]ANYGUIv2.8 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