我的autohotkey脚本似乎是错的,但我仔细检查括号,我认为没关系,但我一直得到错误,否则没有匹配,如果,有什么我错过了吗?
loot1()
{
ImageSearch,violetX, violetY, 266, 141, 579, 527, C:\image\loot.png
If ErrorLevel {
mobs1()
}
else If ErrorLevel=0 {
mousemove(%violetX%,%violetY%)
mouseclick, left
return
}
else
{
sleep, 100
return
}
}
答案 0 :(得分:0)
您应该只使用If
,因为之前的Else if
没有与if (condition1)
{
// executed only if "condition1" equals true
}
else if (condition2)
{
// executed only if "condition1" was false and "condition2" equals true
}
else
{
// executed only if both "condition1" and "condition3" equals false
}
匹配。
示例:
loot1()
{
ImageSearch,violetX, violetY, 266, 141, 579, 527, C:\image\loot.png
If ErrorLevel
{
mobs1()
}
else If ErrorLevel=0
{
mousemove(%violetX%,%violetY%)
mouseclick, left
return
}
else
{
sleep, 100
return
}
}
编辑,也许这是正确答案:
{{1}}
缺少括号,您应该缩进代码以获得更好的可视化效果。