totoita

While statement woth or

4 posts in this topic

#1 ·  Posted (edited)

Hi,

Windows 7 64 bits

Autoit 3.5.4

Adding an or in my while loop create a problem, even if 1 comparison is true it won t exit the while.

 

This did not work, it won t exit the will loop, even if $resultt5 return 1

Local $resultt1 = 10
     Local $resultt2 = 10
     Local $resultt3 = 10
     Local $resultt4 = 10
     Local $resultt5 = 10
     ConsoleWrite(@CRLF & "in the cherche function:" & @CRLF)
     While ( $resultt1 <> 1 or $resultt2 <> 1 or $resultt3 <> 1 or $resultt4 <> 1 or $resultt5 <> 1 )
        $resultt1 = _ImageSearchArea('gc11.bmp', 1, 988, 300, 1498, 860, $xobjectivepos, $yobjectivepos, 85)
        $resultt2 = _ImageSearchArea('gc12.bmp', 1, 988, 300, 1498, 860, $xobjectivepos, $yobjectivepos, 85)
        $resultt3 = _ImageSearchArea('gc13.bmp', 1, 988, 300, 1498, 860, $xobjectivepos, $yobjectivepos, 85)
        $resultt4 = _ImageSearchArea('gc14.bmp', 1, 988, 300, 1498, 860, $xobjectivepos, $yobjectivepos, 85)
        $resultt5 = _ImageSearchArea('gc5.bmp', 1, 988, 300, 1498, 860, $xobjectivepos, $yobjectivepos, 85)
        ConsoleWrite("cherche 5:" & $resultt5 & @CRLF) ; return 1 
        ConsoleWrite("cherche 1:" & $resultt1 & @CRLF); return 0
      sleep (100)
   WEnd
   ConsoleWrite("crate result ds fct cherche:" & @CRLF & $resultt1 & @CRLF & $resultt2 & @CRLF & $resultt3 & @CRLF & $resultt4 & @CRLF & $resultt5 & @CRLF)
  MouseMove($xobjectivepos, $yobjectivepos,0)

This work, it exit the while loop

Local $resultt1 = 10
     Local $resultt2 = 10
     Local $resultt3 = 10
     Local $resultt4 = 10
     Local $resultt5 = 10
     ConsoleWrite(@CRLF & "in the cherche function:" & @CRLF)
     While ( $resultt5 <> 1 )
        $resultt1 = _ImageSearchArea('gc11.bmp', 1, 988, 300, 1498, 860, $xobjectivepos, $yobjectivepos, 85)
        $resultt2 = _ImageSearchArea('gc12.bmp', 1, 988, 300, 1498, 860, $xobjectivepos, $yobjectivepos, 85)
        $resultt3 = _ImageSearchArea('gc13.bmp', 1, 988, 300, 1498, 860, $xobjectivepos, $yobjectivepos, 85)
        $resultt4 = _ImageSearchArea('gc14.bmp', 1, 988, 300, 1498, 860, $xobjectivepos, $yobjectivepos, 85)
        $resultt5 = _ImageSearchArea('gc5.bmp', 1, 988, 300, 1498, 860, $xobjectivepos, $yobjectivepos, 85)
        ConsoleWrite("cherche 5:" & $resultt5 & @CRLF) ; return 1 
        ConsoleWrite("cherche 1:" & $resultt1 & @CRLF); return 0
      sleep (100)
   WEnd
   ConsoleWrite("crate result ds fct cherche:" & @CRLF & $resultt1 & @CRLF & $resultt2 & @CRLF & $resultt3 & @CRLF & $resultt4 & @CRLF & $resultt5 & @CRLF)
  MouseMove($xobjectivepos, $yobjectivepos,0)

Someone might help me to debug this ?

Do not comment the same variable for $xobjectivepos and $yobjectivepos in the imagesearch parameters, i know i have to fix this...it s not the pbl.

 

Thanks.

Ps:how do i delete a post in this forum? (see the post below)
 

Edited by totoita

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

4 minutes ago, totoita said:

 

 

Edited by totoita

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

ok..

thought
or statement was working like 0 or 0 or 0 or 0 or 1 = 1 so true

and statement was working like 0 and 0 and 0 and 0 and 1 = 0 so false
I probably mix this with another language..well..i will try

thanks for helping..it works ( I just try)

 

Edited by totoita

Share this post


Link to post
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