在这个脚本中有点新,我试图从宏应用程序ios/android制作自动化脚本,该脚本使用称为AutoTouch https://autotouch.net/server/doc/en.html#autotouch-document 的Lua语言我不知道从哪里开始,有这样的Lua功能吗?在整个屏幕中搜索颜色,然后点击它脚本与此类似
loop
color = PixelSearch(x coord, y coord, #somergbColor codes)
If (color) is found in screen then
tap it
else
tap teleport skill/walk to search for target button
endif
endloop
end
循环不太具体。您可以使用 AutoTouch 提供的findColor(color, count, region)
或 getColor(x, y)
以两种方式执行内部操作(在我看来,由于返回值,八位字节大小基本上比 getColors(locations)
快;但问题来自开发人员,如果他们不放置字节数组 API 来处理较低的和无符号的整数,当然(。
findColor()
被限制为最多只能找到 1 个像素。
local target = 0x447111;
local location = findColor(target, 1);
local first = location[1];
if location and first then
touchDown(1, first[1], first[2]);
else
-- I don't understand this action?
end
因此,如果您想手动查找颜色,可以使用 getColor()
.
local target = 0x447111;
local w, h = getScreenResolution();
local broken = false;
for y = 1, h do
for x = 1, w do
local cur = getColor(x, y);
if cur == target then
broken = true;
break;
end
end
if broken then
break;
end
end
if broken then
touchDown(1, 1, 1);
end