auto;
requestScreenCapture();
var color = "#802218";
var w = device.width;
var h = device.height;
var arg = 1.3;
var count = 0
//console.show();
while (count < 110) {
var img = captureScreen();
left = findPosition(img, -1);
right = findPosition(img, 1);
log(left);
log(right);
if (left == undefined || right == undefined) {
alert("游戏已结束或脚本已出错;请重新运行脚本");
exit();
}
press(random(w / 4, 3 * w / 4), random(3 * h / 4, h), (right - left) * arg);
sleep(4000);
count++;
}

function findPosition(img, flag) {
for (var i = 0; i < w / 2 - 3; i++) {
var position = findColor(img, color, {
region: [w / 2 - 100 + (i * flag), h - 50, 3, 3],
threshold: 3
});
if (position) {
p = w / 2 + (i * flag);
return p;
}
}
}

为什么我今天没有闯关记了?☹

  • 6
    帖子
  • 405
    浏览

与 Auto.js 的连接断开,我们正在尝试重连,请耐心等待