思路
初始化环境(以脚本中的经验刷取函数为例)
def EX_collection():
n= 0
end = 0
time.sleep(2)
MoveAndClick(r'\Arknight\picture\t.jpg',0.3)#虽然有些离谱但是确实是可信度为0.3时较为稳定
time.sleep(1)#图像识别库有一秒钟左右的延迟,要注意时间暂停提高稳定性
try:
MoveAndClick(r'\Arknight\picture\source collection s.jpg',0.7)
except TypeError:
MoveAndClick(r'\Arknight\picture\source collection.png',0.7)
time.sleep(2)
pyautogui.moveRel(0,-115)
count = 0
while count<5:
Drag_Hriozon(100)
count = count+1
#############################
try:
MoveAndClick(r'\Arknight\picture\tactical exercise.png',0.3)
MoveAndClick(r'\Arknight\picture\LS-6.png',0.6)
except:
pass
time.sleep(2)
模拟点击
模拟点击,当危机合约时
移动鼠标至适宜拖动的位置
接下来是正式刷取部分
while True:
time.sleep(2)
if end ==0:
#代理检查
time.sleep(2)
try:
MoveAndClick(r'\Arknight\picture\empty acting commander.png',0.8)
time.sleep(2)
MoveAndClick(r'\Arknight\picture\Action.png',0.6)
try:
time.sleep(2)
MoveAndClick(r'\Arknight\picture\Action1.png',0.6)
#print(3)
except:
try:#如果一开始就没有理智则结束
a,b = pyautogui.locateCenterOnScreen(r'\Arknight\picture\Source stone.png',confidence=0.6)
end = 1
break
except:
pass
except:#
try:
time.sleep(2)
MoveAndClick(r'\Arknight\picture\Action.png',0.8)
try:
time.sleep(2)
MoveAndClick(r'\Arknight\picture\Action1.png',0.5)
except:
try:#如果一开始就没有理智则结束
a,b = pyautogui.locateCenterOnScreen(r'\Arknight\picture\Source stone.png',confidence=0.6)
end = 1
break
except:
pass
except:
pass
#--------------------------------------
while True:
try:
MoveAndClick(r'\Arknight\picture\Action end.png',0.8)
time.sleep(2)
MoveAndClick(r'\Arknight\picture\Action end.png',0.8)
time.sleep(1)
print("结束刷取")
n = n+1
print('成功刷取%d次'%(n))
try:
time.sleep(3)
MoveAndClick(r'\Arknight\picture\Action.png',0.8)
time.sleep(2)
MoveAndClick(r'\Arknight\picture\Action1.png',0.5)
time.sleep(2)
break
except:
end = 1
break
except:
pass
else:
break
print("本轮刷取结束,共消耗了%d理智"%(n*36))
Exit_From_Resource()
本段思路为外循环加内循环
外循环负责判断当前是否继续刷取资源
内循环负责判断当前单次刷取是否结束
外循环已经展示在思路导图中
下面介绍内循环
1.尝试在当前屏幕上点击这个图片(行动结束时的最左边部分),若不成功则反复执行1.
2.若1成功,那么继续点击,之后点击
,最后回到1.
3.若2不成功,那么循环结束
Exit_From_Resource函数——————————————
def Exit_From_Resource():
Init_Exit()
time.sleep(2)
Init_Exit()
time.sleep(2)
Init_Exit()
time.sleep(2)
Init_Exit()
执行四次Init_Exit函数
——————————————————————————————————————-