我一直在制作一个复杂的机器人,并且在尝试使用图像搜索添加任何新功能时遇到了障碍,这些搜索中的大多数都需要定位(或不定位)图像。但是现在,我尝试添加的每个功能都变得疯狂,有时它会循环运行,找不到图像,有时它会移动到 778、194 并继续点击,好像每次搜索都应该点击 778 , 194. 我敢肯定这太简单了,我只是一遍又一遍地盲读这些块。源代码:
demand()
{
global img_battle
global img_battle2
global img_demand
global img_lolcheck
global img_lolmarket
global img_demandcontrol
global img_demandlower
global img_demandhigher
global img_demand2
ImageSearch, myszX, myszY, 1, 1, windowSizeX, windowSizeY, *10 %img_demand%
8:
if (ErrorLevel = 0) {
4:
MouseMove, 778, 194
Sleep, 500
ImageSearch, myszX, myszY, 1, 1, windowSizeX, windowSizeY, *10 %img_lolmarket%
if (ErrorLevel = 0){
MouseMove, myszX + 15, myszY + 2
sleep, 500
MouseClick, Left,
sleep, 500
ImageSearch, myszX, myszY, 1, 1, windowSizeX, windowSizeY, *10 %img_lolcheck%
if (ErrorLevel = 0) {
sleep, 500
5:
ImageSearch, myszX, myszY, 1, 1, windowSizeX, windowSizeY, *10 %img_demandcontrol%
if (ErrorLevel = 0) {
MouseMove, myszX + 15, myszY + 2
sleep, 500
MouseClick, Left,
Sleep, 500
ImageSearch, myszX, myszY, 1, 1, windowSizeX, windowSizeY, *10 %img_demandlower%
if (ErrorLevel = 0) {
MouseMove, myszX + 15, myszY + 2
sleep, 500
MouseClick, Left
Sleep, 500
6:
MouseMove, 716, 197
Sleep, 500
ImageSearch, myszX, myszY, 1, 1, windowSizeX, windowSizeY, *10 %img_battle%
if (ErrorLevel = 0){
MouseMove, myszX +15, myszY +2
Sleep, 500
MouseClick,
Sleep, 500
ImageSearch, myszX, myszY, 1, 1, windowSizeX, windowSizeY, *10 %img_battle2%
if (ErrorLevel = 1){
goto, 6
}
}
}
else{
goto, 5
}
}
}
else {
goto, 4
}
}
}
else{
ImageSearch, myszX, myszY, 1, 1, windowSizeX, windowSizeY, *10 %img_demand2%
if (ErrorLevel = 1) {
goto, 8
}
}
}