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

geo posted a new comment:
That function checks if the mouse has not moved. If it hasn't after so
many times the program will refresh the browser. This is because
sometimes the game doesn't show any eggs or other similar errors. here
is the code.

def checkLastMouseLocation(currentMouseLocation):
    file.write("Mouse last location\n")  #DEBUG
    global lastMouseLocation
    global sameLocationCounter

    #print("curr --> %s : last --> %s" % (currentMouseLocation, 
lastMouseLocation))
    if currentMouseLocation == lastMouseLocation:
        sameLocationCounter += 1

    else:
        lastMouseLocation = currentMouseLocation
        sameLocationCounter = 0

        checkLastMouseLocation()


and here is the refrseh code. Nothing fancy

#too many fails. Refresh the browser
def checkRefreh():
    file.write("checkRefresh\n")  #DEBUG
    global notFoundCounter
    global sameLocationCounter
    global inActiveMode
    
    if ((notFoundCounter >= 30) or (sameLocationCounter >=20)):
        #popup("REFRESH!!!!") #DEBUG
        if region5.exists("1458036200954.png"):
            click(region5.getLastMatch())
            wait(4)
            hover(Location(0,0))
            wait(4)
            print("----PAGED REFRESHED----")
            #reset flags and counter
            notFoundCounter = 0 
            sameLocationCounter = 0
            inActiveMode = False

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

_______________________________________________
Mailing list: https://launchpad.net/~sikuli-driver
Post to     : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp

Reply via email to