Skip to main content

Multi-point Color Match (screen.is_colors)

Declaration

matched = screen.is_colors({
[max_miss = integer_value,]
[xy_tolerance = integer_value,]
[csim_algorithm = integer_value,]
{x1, y1, color1},
{x2, y2, color2},
...
}[, similarity])

Parameters

  • max_miss
    Integer, optional. Maximum number of non-matching points allowed. Default 0 (all points must match).

  • xy_tolerance
    Integer, optional. Allowed coordinate deviation; points exceeding this offset are treated as miss. Default 0.

  • csim_algorithm
    Integer, optional. Color similarity algorithm. Default 0.

    Algorithms
    0 = XXT default (steep gradient, similarity drops quickly with difference)
    1 = Manhattan (smooth)
    2 = Euclidean (smooth)
  • x, y
    Integer. Coordinate of a point.

  • color
    Integer. Expected color value of the point.

  • similarity
    Integer, optional. Similarity threshold shared by all points when individual similarity is not specified. Range 1~100, default 100.

Returns

  • matched
    Boolean. true if all points match under the rules, otherwise false.

Description

Match colors of several points on the screen.
Coordinate parameters follow the coordinate system initialized via screen.init.

Example

if screen.is_colors({
{ 509, 488, 0xec1c23},
{ 514, 470, 0x00adee},
{ 508, 478, 0xffc823},
{ 511, 454, 0xa78217},
{ 521, 433, 0xd0d2d2},
}, 90) then
sys.alert("Matched!")
else
sys.alert("Not matched!")
end

Note: Uses sys.alert