← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #175717]: Need help! with find or skip

 

Question #175717 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/175717

RaiMan posted a new comment:
BTW: When using exists() in such if/else constructs, I always recommend to use exists(,0), to search only once per exists() and not waiting 3 seconds, if not there.
If in a loop it makes sense, to add some wait() per loop step, to avoid cpu overload.

in your case:

max = 3
while max > 0:
    found = None
    if not exists(iron1, 0):
        if exists(iron2, 0):
            found = getLastMatch()
    else:
        found = getLastmatch()
    if not found:
        max -= 1
    click(found)
    wait(1)

This will reloop about every 1.5 to 2 seconds (1 sec wait + 2 times
search). So with adjusting the waiting time, you can adjust the loops
"frame rate".

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