参数:
nt_msg 成功后的提示信息 dd_x 找到查找点后的点击位置x 若为0 点击查到的位置 若为-1 不点击 dd_y 找到查找点后的点击位置y 若为0 点击查到的位置 dd_x2 未找到查找点后的点击位置x 若为0 不点击 dd_y2 未找到查找点后的点击位置y 若为0 不点击 cz_count 查找次数 每秒1次 cz_color 查找颜色值 cz_points 查找颜色的相对点位 cz_offset 查找精度 cz_lt_x 查找范围 左上 x cz_lt_y 查找范围 左上 y cz_rb_x 查找范围 右下 x cz_rb_y 查找范围 右下 y返回值:
cz_success 查找成功与否用法示例:
成功 = jop.cz_dd_common(nt_msg, dd_x, dd_y, dd_x2, dd_y2, cz_count, cz_color, cz_points, cz_offset, cz_lt_x, cz_lt_y, cz_rb_x, cz_rb_y) jop = {} --获取当前时间 jop.current_time = os.date("%Y-%m-%d", os.time()); function jop.cz_dd_common(nt_msg, dd_x, dd_y, dd_x2, dd_y2, cz_count, cz_color, cz_points, cz_offset, cz_lt_x, cz_lt_y, cz_rb_x, cz_rb_y) local cz_success = false --mSleep(0.5 * 1000) --休眠准备 toast(nt_msg..'开始查找',1) mSleep(1000) local x, y = findMultiColorInRegionFuzzy(cz_color, cz_points, cz_offset, cz_lt_x, cz_lt_y, cz_rb_x, cz_rb_y) local run_count = 1 while x == -1 and run_count < cz_count do run_count = run_count + 1 toast(nt_msg..'开始查找, 第'..run_count..'次!',1) mSleep(1000) x,y = findMultiColorInRegionFuzzy(cz_color, cz_points, cz_offset, cz_lt_x, cz_lt_y, cz_rb_x, cz_rb_y) if x == -1 and dd_x2 ~= 0 and dd_y2 ~= 0 then randomsTap(dd_x2, dd_y2,10) end end if x ~= -1 and y ~= -1 then cz_success = true if dd_x == 0 then dd_x = x dd_y = y end if dd_x ~= -1 then randomsTap(dd_x, dd_y) end toast(nt_msg,1) mSleep(1000) else toast(nt_msg..'查找失败',1) mSleep(3000) snapshot(jop.current_time..".png", 0, 0, 1134, 639); --以时间戳命名进行截图 mSleep(1000) end return cz_success end return jop