← Back to team overview

sikuli-driver team mailing list archive

[Question #682258]: I want to make "if" statement inside the first "if" statement and it just didn't detect anything from condition. Help.

 

New question #682258 on Sikuli:
https://answers.launchpad.net/sikuli/+question/682258

Ok, so I am not a programmer. I self-study and learn a little bit, not much.

So my problem is I want to put another "if" inside the first "if" statement but it seems like sikulix just ignored it? I don't  get any error but it skipped to "else" instead I really have no clue and I tried to solve this problem by myself for 3 days and haven't figured it out yet.

here my script:
++++++++++++++++++++++++++++++++
import random
running = True

while running:
     wait(1.5)
     if Region(722,262,91,117).exists("Idle.png" or Pattern("cautionwarning.png").similar(0.50), 0.5):
          type("s")
          if Region(626,283,249,26).exists("1563896526299-1.png", 0.5):
               type(Key.TAB)
               type("Well I am joking its not")
               type(Key.ENTER)
          else:
               wait(5)
          Settings.WaitScanRate = 9
          Region(741,437,58,34).wait(Pattern("1563771733509.png").similar(0.75), 10)
          Settings.WaitScanRate = 9
          Region(719,438,61,29).waitVanish(Pattern("1563771733509.png").similar(0.75), 60)
          type("s")
          sleep(1)
          keyDown(Key.DOWN)
          sleep(1)
          keyUp(Key.DOWN)

     else:
          type(Key.TAB)
          word = random.choice(["lol", "wtf","Wossshh",  "Bruhhh", "......", "Hm", "showfishlevel", "YEEET"])
          type(word)
          type(Key.ENTER)
          wait(1)
          keyDown(Key.UP)
          wait(1)
          keyUp(Key.UP)
          keyDown(Key.LEFT)
          wait(5)
          keyUp(Key.LEFT)
          keyDown(Key.RIGHT)
          Settings.WaitScanRate = 9
          Region(735,264,73,118).wait(Pattern("1563778771909.png").similar(0.59) or Pattern("1563802583998.png").similar(0.58), 10)
          keyUp(Key.RIGHT)
          keyDown(Key.DOWN)
          wait(1)
          keyUp(Key.DOWN)

I tested it and it just ignored or didn't see "Idle.png" or "cautionwarning.png" 

but if I remove    

          if Region(626,283,249,26).exists("1563896526299-1.png", 0.5):
               type(Key.TAB)
               type("Well I am joking its not")
               type(Key.ENTER)
          else:
               wait(5)

it will work properly I really don't know why!  Please help!

Best Regards

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.