vendredi 25 décembre 2015

Why does that loop sometimes click randomly on screen?

I have made that loop my self and Iam trying to make it faster, better... but sometimes after it repeat searching for existing... it press random ( i think cuz its not similar to any img iam using in sikuli ) place on the screen. Maybe you will know why.

Part of this loop below

    while surowiec_1:        
        if exists("1451060448708.png", 1) or exists("1451061746632.png", 1):
            foo = [w_lewo, w_prawo, w_dol, w_gore]                
            randomListElement = foo[random.randint(0,len(foo)-1)]
            click(randomListElement)
            wait(3)
        else:
            if exists("1450930340868.png", 1 ):
                click(hemp)
                wait(1)
                hemp = exists("1450930340868.png", 1)
            elif exists("1451086210167.png", 1):
                click(tree)
                wait(1)
                tree = exists("1451086210167.png", 1)
            elif exists("1451022614047.png", 1 ):
                hover("1451022614047.png")
                click(flower)
                flower = exists("1451022614047.png", 1)
            elif exists("1451021823366.png", 1 ):
                click(fish)
                fish = exists("1451021823366.png")
            elif exists("1451022083851.png", 1 ):
                click(bigfish)
                bigfish = exists("1451022083851.png", 1)
            else: 
                foo = [w_lewo, w_prawo, w_dol, w_gore]                
                randomListElement = foo[random.randint(0,len(foo)-1)]
                click(randomListElement)
                wait(3)

I wonder if this is just program problem with img recognitions or I have made a mistake.




Aucun commentaire:

Enregistrer un commentaire