Orgins Posted May 18, 2008 Share Posted May 18, 2008 It should be comparing two images and if they match 98% or more it sets healed to yes (ending the loop). But It's setting healed to yes when its no where near 98%. expandcollapse popupDo _ScreenCapture_Capture ("lifenow.jpg", 356, 124, 373, 146) Sleep(1900) $life1 = Compare("lifenow.jpg", "lifewanted.jpg", 17, 22, 1) If $life1[1] > 98 Then $healed = "yes" EndIf Sleep(50) Until $healed = "yes" ;;;;;;;;;;the compare func works I did not edit it from when was working. Func Compare($Pic1, $Pic2, $Width, $Height, $Step = 1) Local $Color[$Width + 1][$Height + 1], $Color2[$Width + 1][$Height + 1], $Var = 0, $Var2 = 0 $Compare = GUICreate("", $Width, $Height, -1, -1, $WS_POPUP, $WS_EX_TOPMOST) GUISetState(@SW_SHOW, $Compare) $Pic = GUICtrlCreatePic($Pic1, "", "", $Width, $Height) For $y = 1 To $Height Step $Step For $x = 1 To $Width $Color[$x][$y] = PixelGetColor($x, $y) Next Next GUICtrlSetImage($Pic, $Pic2) For $y = 1 To $Height Step $Step For $x = 1 To $Width $Color2[$x][$y] = PixelGetColor($x, $y) If $Color[$x][$y] = $Color2[$x][$y] Then $Var += 1 Else $Var2 += 1 EndIf Next Next $Need = $Var + $Var2 $Result = ($Var / $Need) * 100 Sleep(75) GUIDelete($Compare) Dim $Return[4] = [$Need, Round($Result, 1), $Var, $Var2] Return $Return EndFunc ;==>CompareWhat I want to match.What should not be matching but it is. I'm a newbie.Sorry if I don't reposed to your replays very fast. Link to comment Share on other sites More sharing options...
TnTProductions Posted May 18, 2008 Share Posted May 18, 2008 (edited) did you think about adding a second option where if $life is NOT >98 it will have $healed = "no" ? that might solve your problem..... P.S: when i ran your script it came up with errors. Edited May 18, 2008 by TnTProductions "FREEDOM is not FREE""Its a good thing war is so terrible, or we grow too fond of it" -Robert E. Lee[quote]Firestrom: global $warming = False[/quote]My scripts:Desktop Cleaner---->Total Downloads:167;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;111111;;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;11;;;;;;"a wise man once said why use your skills when we have technology" Link to comment Share on other sites More sharing options...
TnTProductions Posted May 18, 2008 Share Posted May 18, 2008 so since you dont have the second option the script can only chose that options as the answer "FREEDOM is not FREE""Its a good thing war is so terrible, or we grow too fond of it" -Robert E. Lee[quote]Firestrom: global $warming = False[/quote]My scripts:Desktop Cleaner---->Total Downloads:167;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;111111;;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;11;;;;;;"a wise man once said why use your skills when we have technology" Link to comment Share on other sites More sharing options...
Orgins Posted May 18, 2008 Author Share Posted May 18, 2008 (edited) did you think about adding a second option where if $life is NOT >98 it will have $healed = "no" ? that might solve your problem..... P.S: when i ran your script it came up with errors. Ya I fergot #include <ScreenCapture.au3>. I tried: #include <ScreenCapture.au3> Do $life1 = Compare("lifenow.jpg", "lifewanted.jpg", 17, 22, 1) ;the to images in first post If $life1[1] > 98 Then $healed = "yes" Tooltip("Fully healed") Sleep(3000) Else $healed = "No" Tooltip("Not fully healed") Sleep(3000) EndIf Sleep(50) Until $healed = "yes" and #include <ScreenCapture.au3> Do $life1 = Compare("lifenow.jpg", "lifewanted.jpg", 17, 22, 1) ;the to images in first post If $life1[1] > 98 Then $healed = "yes" Tooltip("Fully healed") Sleep(3000) EndIf If $life1[1] NOT > 98 Then $healed = "no" Tooltip("Not Fully healed") Sleep(3000) endif Sleep(50) Until $healed = "yes" Both put healed as yes when it should of been no. Edited May 18, 2008 by Orgins I'm a newbie.Sorry if I don't reposed to your replays very fast. Link to comment Share on other sites More sharing options...
Orgins Posted May 19, 2008 Author Share Posted May 19, 2008 Bump-ish. I recoded it so I don't have to use this but I'd still like to know whats wrong with it. I'm a newbie.Sorry if I don't reposed to your replays very fast. Link to comment Share on other sites More sharing options...
evilertoaster Posted May 19, 2008 Share Posted May 19, 2008 PixelGetColor() is always returning the same colors becuase it searches relative to your whole screen not the GUI window currently open. Look into Opt("PixelCoordMode") for modification of this behavior. 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