函数:findMultiColorInRegionFuzzy 区域多点找色
函数名称:多点找色,区域多点找色
函数功能:在指定区域,根据基准点颜色以及其周边参照点的相对坐标颜色,寻找符合条件的点的坐标,支持模糊查找。
支持版本:仅支持 v1.0.8 及以上版本
函数方法
x, y = findMultiColorInRegionFuzzy(color,posandcolors,degree,x1,y1,x2,y2)
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
color | number | 是 | 基准点颜色 |
posandcolors | string | 是 | 周边参照点颜色参数 |
degree | number | 是 | 寻找精度,范围:1 ~ 100,当是 100 时为完全匹配 |
x1 | number | 是 | 找色区域左上角顶点屏幕横坐标 |
y1 | number | 是 | 找色区域左上角顶点屏幕纵坐标 |
x2 | number | 是 | 找色区域右下角顶点屏幕横坐标 |
y2 | number | 是 | 找色区域右下角顶点屏幕纵坐标 |
函数用例
x,y = findMultiColorInRegionFuzzy(0xfff4e6, "19|-29|0xff3c4a,7|-8|0xfff6ef,23|4|0xe74447,-19|-27|0xff9b89,-8|-9|0xffe7e5", 90, 516, 2491, 706, 2648)
if x ~= -1 then
nLog("x:"..x..",y:"..y)
mSleep(1000)
event.tap(x,y)
else
dialog("未找到")
end
注意事项
- posandcolor 参数中的坐标为相对坐标。
- 相对于基准点的坐标,即用参照点的横坐标、纵坐标分别减去基准点的横坐标、纵坐标,可以为负数。
- 多点找色的代码可直接用触动精灵取色工具生成。
- 颜色值的十六进制文本中,其顺序为 RGB。
- 使用此函数时精度参数设置过低,会导致性能大幅下降。