函数:findColorsUntil 区域多点循环比色

函数功能:在选定区域内循环匹配基准点和周边参考点坐标和颜色值并返回找到的坐标

TSLib 版本:仅 v1.2.8 及其以上版本支持

函数方法

bool,tim,x,y = findColorsUntil (color,posandcolors,degree,x1,y1,tab,ms,timeout)

参数 类型 必填 说明
color number 基准点颜色
posandcolors string 周边参考点颜色
degree number 匹配精度,不写默认默认 90
x1 number 找色区域左上角顶点屏幕横坐标
y1 number 找色区域左上角顶点屏幕纵坐标
x2 number 找色区域右下角顶点屏幕横坐标
y2 number 找色区域右下角顶点屏幕纵坐标
tab table 高阶用法,详见 findMultiColorInRegionFuzzy 函数
ms number 找色频率,不写默认为 100 毫秒
timeout number 超时时间,不写默认为 60 秒
返回值 类型 说明
bool boolean true - 存在;false - 不存在
tim number 消耗时间,单位:秒
x, y number 返回符合条件的基准点的坐标,如未找到则返回 -1,-1

函数用例

require("TSLib")
bool,tim,x,y =  findColorsUntil(0xffca00, "-11|-11|0xffca00,-43|-3|0x00a9ee,-72|45|0x16c6df,-26|39|0xffffff,-5|69|0x00a8ee", 90, 166, 540, 338, 731,{ orient = 2 },200,10)
if bool then
    dialog("消耗时间:"..tim.."\n".."x:"..x.."\n".."y:"..y)
else
    dialog("未找到")
end

注意事项

  • 雷电 9 系统模拟器分辨率为平板版时使用函数:getScreenSize 获取的屏幕宽高相反,获取到的宽度实际为屏幕高度,获取的高度实际为屏幕宽度,其他模拟器获取的屏幕宽高为实际屏幕宽高。
Copyright 北京帮你玩科技有限公司 2023 all right reserved,powered by Gitbook该文章修订时间: 2024-03-06 17:50:18

results matching ""

    No results matching ""