早教吧 育儿知识 作业答案 考试题库 百科 知识分享

autohotkey脚本IF语句问题实践证明以下这个脚本在满足if的条件时,执行了Click,665,164,1这行命令,但是不再继续往下执行了,而是不停地跳到label1,请问这是为什么?怎么做到在满足IF语句时停止循

题目详情
autohotkey脚本IF语句问题
实践证明以下这个脚本在满足if 的条件时,执行了 Click,665,164,1这行命令,但是不再继续往下执行了,而是不停地跳到label1,请问这是为什么?怎么做到在满足IF语句时停止循环
F1::
label0:
sleep,2000
send,H
click,89,503,1;
sleep,2000
click,150,204,1;
sleep,2000
click,223,477,1;
sleep,2000
label1:
sleep,2000
click 665,164,0;
color1=PixelGetColor,color1,665,164;
if (color1 = 0x0008BC)
{
sleep,2000
Click,665,164,1
sleep,1000
label2:
sleep,2000
click,750,539,0
color2=PixelGetColor,color2,750,539
if (color2 = 0x000CBC)
{
Click,750,539,1
sleep,30000
goto,label0
}
Else goto,label2
}
Else goto,label1
OK了
F1::
开始:
sleep,2000
send,H
sleep,1000
click,89,503,1;
sleep,1000
click,150,175,1;
sleep,1000
click,223,477,1;
sleep,1000
Loop
{
PixelGetColor,Color,665,164
sleep,1000
if Color = 0x000068 ;
break
sleep,1000
}
click,665,164,1
sleep,30000
Loop
{
sleep,5000
send,{space}
sleep,1000
PixelGetColor,color,750,539
if color = 0x000263
Break
PixelGetColor,color,720,165
if color = 0x00006C
{
click,720,165,1
MouseMove,300,300
}
Else continue
}
Click,750,539,1
sleep,30000
goto,开始
▼优质解答
答案和解析
我觉得是楼主写得有问题
不知道是你境界太高了还是我不行
你整篇都没有返回return
明显出错啊
你得if被包括在label1里面了
我不知道你得label1到底包含什么东西
所以稍作修改
F1::
MouseGetPos, MouseX, MouseY
PixelGetColor, color, %MouseX%, %MouseY%
if (%color% = 0x0008BC)
{
sleep,2000
Click,665,164,1
sleep,1000
label2:
sleep,2000
click,750,539,0
MouseGetPos, MouseX, MouseY
PixelGetColor, color, %MouseX%, %MouseY%
if (%color% = 0x000CBC)
{
Click,750,539,1
sleep,30000
goto,label0
}
Else goto,label2
}
Else goto,label1
return
label0:
sleep,2000
send,H
click,89,503,1;
sleep,2000
click,150,204,1;
sleep,2000
click,223,477,1;
sleep,2000
return
label1:
sleep,2000
click 665,164,0;
return
格式很重要
return也是
不知道你是不是要这个意思
不行再说