← Back to team overview

sikuli-driver team mailing list archive

[Question #224927]: i need to make my script faster and smarter!!

 

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

okay i have put alot of hours into learning from other peoples mistakes and finaly got a pretty nice script going. but i notice that it would take to long to look for the images, let alone that i had to use a ton of wait() and sleep() in between and also it would find the wrong images and click on them. Could i set a region for every image? ill also post my script so u could give me a few pointers or rewrite the whole thing =)

while exists("1363880501079.png", 20):
    click( getLastMatch(), 0)
    wait(10)
    if exists(Pattern("1363668269597.png").similar(0.80), 10):
        click(Pattern("1363668269597.png").similar(0.80), 10)
        wait(10)
        click(Pattern("1363668269597.png").similar(0.81))
        if exists(Pattern("eaHnfowI.png").similar(0.81), 15): 
            doubleClick(Pattern("eaHnfowI.png").similar(0.80))
        wait(15)
        if exists(Pattern("eaHnfowI.png").similar(0.80), 15): 
            doubleClick(Pattern("eaHnfowI.png").similar(0.80))
        wait(15)
        if exists(Pattern("Enter.png").similar(0.80), 15): 
            doubleClick(Pattern("Enter-1.png").similar(0.80))
        wait(15)
        if exists(Pattern("Enter.png").similar(0.80), 15): 
            doubleClick(Pattern("Enter-1.png").similar(0.80))
            wait(15), click("1363668856359.png")
            #**START OVER AT BEGINNING OF CODE**
    if exists(Pattern("1363919377569.png").similar(0.80)):
        click( getLastMatch(), 0)
        if exists("1363674112299.png", 0): 
            sleep(1800)
            rightClick("1363664789593.png")
            click("Rastart.png")
            while exists("RageofBahamu.png",40):
                click( getLastMatch(), 0)
                while exists("C10IDG00gIPI.png", 70):
                    click("N0Thlk5.png", 0)
                    #**START OVER AT BEGINNING OF CODE**
        if exists("1363880884438.png", 20):
            click("1363667165970-2.png")
            wait(10)
            click("1363668856359.png")
        if not exists("1363880884438.png"):
            rightClick("1363664789593.png")
            click("Rastart.png")
            while exists("RageofBahamu.png",40):
                click( getLastMatch(), 0)
                while exists("C10IDG00gIPI.png", 70):
                    click("N0Thlk5.png", 0)


the goal was to start the game manually, then turn on the script. It would then look for image1 then click it, then do the 2 "if exists" then under each one it would have different situations it must act if "image6 or image8 or image9" appears. at the end it loops. also sometimes it skips the "if exists" and does "if not exists", could i build that into a true or false statement only if the other 2 "if exists" are not found so it doesnt skip my 'if exists? any and all help is greatly appreciated!!

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.