Jump to content

need help with OR statement


Recommended Posts

e.g. If MyFunc1() Or MyFunc2() Then (MyFunc2() is not called if MyFunc1() returns true)

e.g. If MyFunc1() And MyFunc2() Then (MyFunc2() is not called if MyFunc1() returns false)

that the example i saw

Func IMR93()
       while 1
          sleep(1000)
         $IMR11= _ImageSearch('star.png', 0, $X, $Y, 0)
         $IMR934= _ImageSearch('stars.png', 0, $X, $Y, 0)
         if $IMR11 = 1 Or $IMR934 = 1 Then
            ss()
            MouseClick("left")
            sleep(600)
             MouseClick("left", 374, 672) 
            sleep(1000)
            IMR935()
         else
            sleep(100)
            start()
         EndIf
      WEnd
   EndFunc

Func IMR935()
   Do
$pix935 = PixelSearch(547, 219, 549,219, 0xDFA188);
Until IsArray ($pix935)
   sleep(200)
   MouseClick("left",547, 219,1,10)
   sleep(500)
   IMR955()
EndFunc

func IMR955()
   sleep(250)
MouseClickDrag("left", 377, 464, 364, 938) ;
sleep(8000)
MouseClick("left")
sleep(1000)
ss()
MouseClick("left")
sleep(600)
IMR94()
EndFunc

 Func IMR94() ;this one doesnt work right
  while 1
 sleep(1000)
$IMR112= _ImageSearch('star.png', 0, $X, $Y, 0)
 $IMR9442= _ImageSearch('stars.png', 0, $X, $Y, 0)
if $IMR112 = 1 Or $IMR9442 = 1 Then
ss()
sleep(200)
MouseClick("left", 374, 672) ;
sleep(750)
IMR95()
else
sleep(100)
start()
EndIf
 WEnd
   EndFunc
 

it does for the first part but then 2nd part it doent check n starts over

Edited by pdark1987
Link to comment
Share on other sites

Also, many functions that you have not included. 

This could be pertinent information. ;) 

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Link to comment
Share on other sites

What you're describing is exactly what is supposed to happen, if the first one won't satisfy the And or Or, the second one doesn't need to be called at all.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Func IMR93()
       while 1
          sleep(1000)
         $IMR11= _ImageSearch('star.png', 0, $X, $Y, 0)
         $IMR934= _ImageSearch('stars.png', 0, $X, $Y, 0)
         if $IMR11 = 1 Or $IMR934 = 1 Then
            ss()
            MouseClick("left")
            sleep(600)
             MouseClick("left", 374, 672) 
            sleep(1000)
            IMR935()
         else
            sleep(100)
            start()
         EndIf
      WEnd
   EndFunc

so in this functions if its star or stars it will go the IMR935()

Func IMR935()
   Do
$pix935 = PixelSearch(547, 219, 549,219, 0xDFA188);
Until IsArray ($pix935)
   sleep(200)
   MouseClick("left",547, 219,1,10)
   sleep(500)
   IMR955()
EndFunc

func IMR955()
   sleep(250)
MouseClickDrag("left", 377, 464, 364, 938) ;
sleep(8000)
MouseClick("left")
sleep(1000)
ss()
MouseClick("left")
sleep(600)
IMR94()
EndFunc

 Func IMR94() ;this one doesnt work right
  while 1
 sleep(1000)
$IMR112= _ImageSearch('star.png', 0, $X, $Y, 0)
 $IMR9442= _ImageSearch('stars.png', 0, $X, $Y, 0)
if $IMR112 = 1 Or $IMR9442 = 1 Then
ss()
sleep(200)
MouseClick("left", 374, 672) ;
sleep(750)
IMR95()
else
sleep(100)
start()
EndIf
 WEnd
   EndFunc

so once it get to IMR94()

if its star or stars it should go IMR95()

but when i run IMR94() function alone it works fine, but when it runs in a script from IMR93() to end of IMR94()  function isnt working correctly then. when it gets to imr95 n if the image is star or stars it still ended up restarting rather then going to IMR95()

so a bit confused about that

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