GeMercher.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:RunescapeBots 作者: lukegarbutt 项目源码 文件源码
def wait_for(image, runescape_window):
    # adding a possible failsafe in here
    time_entered = time.time()
    # could add a failsafe in here incase we misclick or something, this
    # should be something to come back to
    failsafe_count = 0
    while(True):
        found = pyautogui.locateOnScreen(image, region=(runescape_window.top_left_corner[0], runescape_window.top_left_corner[1], runescape_window.bottom_right_corner[
                                         0] - runescape_window.top_left_corner[0], runescape_window.bottom_right_corner[1] - runescape_window.top_left_corner[1]))
        if found != None:
            break
        elif failsafe_count > 10:
            print("We can't seem to fix the problem so the script is now aborting")
            quit()
        elif time.time()-time_entered > 5 :
            failsafe_count += 1
            print('We appear to be stuck so attempting to move the mouse and see if this fixes it')
            #print('For debug:')
            #print(runescape_window.bottom_right_corner[0], runescape_window.top_left_corner[0])
            #print(runescape_window.bottom_right_corner[1], runescape_window.top_left_corner[1])
            realmouse.move_mouse_to(random.randint(runescape_window.top_left_corner[0], runescape_window.bottom_right_corner[0]), random.randint(runescape_window.top_left_corner[1], runescape_window.bottom_right_corner[1]))
            #pyautogui.click()
            time_entered = time.time()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号