Jump to content

Why isn't this working?


Recommended Posts

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%.

Do
_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  ;==>Compare

What I want to match.

Posted Image

What should not be matching but it is.

Posted Image

I'm a newbie.Sorry if I don't reposed to your replays very fast.

Link to comment
Share on other sites

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 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

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

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 by Orgins

I'm a newbie.Sorry if I don't reposed to your replays very fast.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...